Example #1
0
 public function get()
 {
     $arLotinfoTypes = $this->getLotinfoTypes();
     if (!empty($arLotinfoTypes)) {
         Common::recRMDir($this->arParams['XML_DIR']);
         Common::recRMDir($this->arParams['TMP_DIR']);
         foreach ($arLotinfoTypes as $arType) {
             $curlResult = Curl::getFile($this->arParams['XML_FILE'], $this->arParams['XML_DIR'], $arType, $this->arParams['API_URL'], ['apiKey' => $this->arParams['API_KEY'], 'cmd' => $this->arParams['API_CMD'], 'getData' => $this->arParams['GET_PARAMS']]);
             if (!$curlResult or !file_exists($curlResult)) {
                 $this->errors .= \Helper::boldColorText("Curl::getFile error: " . Curl::$ERROR, "red");
             } else {
                 try {
                     $parseXml = new ParseXml($curlResult, $this->arParams['TMP_DIR']);
                     $result = $parseXml->getData();
                     if (!$result) {
                         $this->errors .= \Helper::boldColorText("ObjectType - {$arType}: " . $parseXml->error, "red");
                     } else {
                         $this->message .= \Helper::boldColorText("ObjectType - {$arType}: Файл получен и обработан", "green");
                     }
                 } catch (Exception $e) {
                     $this->errors .= \Helper::boldColorText($e->getMessage(), "red");
                 }
             }
         }
     } else {
         $this->errors = \Helper::boldColorText("Нет номеров объектов Лотинфо", "red");
     }
     $log = !empty($this->errors) ? \Helper::boldColorText("Errors", "black") . $this->errors : "";
     $log .= !empty($this->message) ? \Helper::boldColorText("Messages", "black") . $this->message : "";
     file_put_contents($this->arParams['LOG_FILE'], $log, FILE_APPEND);
 }
Example #2
0
<?php

##################################################
# Created by Abdul Ibrahim
# Jul 25, 2015 9:15:44 PM
# website http://www.abdulibrahim.com/
##################################################
include 'parse.class.php';
include 'curl.class.php';
$parse = new Parse();
$curl = new Curl();
$url = 'http://abdulibrahim.com';
$curl->getFile($url);
$file = $curl->file;