本文整理匯總了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;