本文整理汇总了PHP中Curl::getFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Curl::getFile方法的具体用法?PHP Curl::getFile怎么用?PHP Curl::getFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Curl
的用法示例。
在下文中一共展示了Curl::getFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
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);
}
示例2: Parse
<?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;