本文整理汇总了PHP中CHTTP::Query方法的典型用法代码示例。如果您正苦于以下问题:PHP CHTTP::Query方法的具体用法?PHP CHTTP::Query怎么用?PHP CHTTP::Query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHTTP
的用法示例。
在下文中一共展示了CHTTP::Query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendCDNRequest
public function SendCDNRequest($settings, $verb, $bucket, $file_name = '', $params = '', $content = false, $additional_headers = array())
{
$arToken = $this->_GetToken($settings["HOST"], $settings["USER"], $settings["KEY"]);
if (!$arToken) {
return false;
}
if (isset($arToken["X-CDN-Management-Url"])) {
if (preg_match("#^http://(.*?)(|:\\d+)(/.*)\$#", $arToken["X-CDN-Management-Url"], $arCDN)) {
$Host = $arCDN[1];
$Port = $arCDN[2] ? substr($arCDN[2], 1) : 80;
$Urn = $arCDN[3];
$Proto = "";
} elseif (preg_match("#^https://(.*?)(|:\\d+)(/.*)\$#", $arToken["X-CDN-Management-Url"], $arCDN)) {
$Host = $arCDN[1];
$Port = $arCDN[2] ? substr($arCDN[2], 1) : 443;
$Urn = $arCDN[3];
$Proto = "ssl://";
} else {
return false;
}
} else {
return false;
}
$obRequest = new CHTTP();
$obRequest->additional_headers["X-Auth-Token"] = $arToken["X-Auth-Token"];
foreach ($additional_headers as $key => $value) {
$obRequest->additional_headers[$key] = $value;
}
$obRequest->Query($verb, $Host, $Port, $Urn . CCloudUtil::URLEncode("/" . $bucket . $file_name . $params, "UTF-8"), $content, $Proto);
return $obRequest;
}
示例2: SendRequest
function SendRequest($access_key, $secret_key, $verb, $bucket, $file_name = '/', $params = '')
{
global $APPLICATION;
$this->status = 0;
$RequestMethod = $verb;
$RequestHost = "sts.amazonaws.com";
$RequestURI = "/";
$RequestParams = "";
$params['SignatureVersion'] = 2;
$params['SignatureMethod'] = 'HmacSHA1';
$params['AWSAccessKeyId'] = $access_key;
$params['Timestamp'] = gmdate('Y-m-d') . 'T' . gmdate('H:i:s');
//.preg_replace("/(\d\d)\$/", ":\\1", date("O"));
$params['Version'] = '2011-06-15';
ksort($params);
foreach ($params as $name => $value) {
if ($RequestParams != '') {
$RequestParams .= '&';
}
$RequestParams .= urlencode($name) . "=" . urlencode($value);
}
$StringToSign = "{$RequestMethod}\n" . "{$RequestHost}\n" . "{$RequestURI}\n" . "{$RequestParams}";
$Signature = urlencode(base64_encode($this->hmacsha1($StringToSign, $secret_key)));
$obRequest = new CHTTP();
$obRequest->Query($RequestMethod, $RequestHost, 443, $RequestURI . "?{$RequestParams}&Signature={$Signature}", false, 'ssl://');
$this->status = $obRequest->status;
$this->headers = $obRequest->headers;
$this->errno = $obRequest->errno;
$this->errstr = $obRequest->errstr;
$this->result = $obRequest->result;
if ($obRequest->status == 200) {
if ($obRequest->result) {
$obXML = new CDataXML();
$text = preg_replace("/<" . "\\?XML.*?\\?" . ">/i", "", $obRequest->result);
if ($obXML->LoadString($text)) {
$arXML = $obXML->GetArray();
if (is_array($arXML)) {
return $arXML;
}
}
//XML parse error
$APPLICATION->ThrowException(GetMessage('CLO_SECSERV_S3_XML_PARSE_ERROR', array('#errno#' => 1)));
return false;
} else {
//Empty success result
return array();
}
} elseif ($obRequest->status > 0) {
if ($obRequest->result) {
$APPLICATION->ThrowException(GetMessage('CLO_SECSERV_S3_XML_ERROR', array('#errmsg#' => $obRequest->result)));
return false;
}
$APPLICATION->ThrowException(GetMessage('CLO_SECSERV_S3_XML_PARSE_ERROR', array('#errno#' => 2)));
return false;
} else {
$APPLICATION->ThrowException(GetMessage('CLO_SECSERV_S3_XML_PARSE_ERROR', array('#errno#' => 3)));
return false;
}
}
示例3: GetBoardFromSite
function GetBoardFromSite($queryParameters)
{
global $APPLICATION;
$result = array();
$ob = new CHTTP();
$ob->http_timeout = 60;
$ob->Query("GET", "old.vnukovo.ru", 80, "/rus/for-passengers/board1/data.wbp?" . $queryParameters . '&ts=' . mktime(), false, "", "N");
$result["ERROR"]["CODE"] = $ob->errno;
$result["ERROR"]["MESSAGE"] = $ob->errstr;
if (!intval($result["ERROR"]["CODE"])) {
$res = $APPLICATION->ConvertCharset($ob->result, "UTF-8", SITE_CHARSET);
//trace($res);
$xml = new CDataXML();
if ($xml->LoadString($res) && ($node = $xml->SelectNodes("/responce/rows"))) {
$rows = $node->elementsByName("row");
$akNames = array();
$akCodes = array();
$departures = array();
$arrivals = array();
$terminals = array();
foreach ($rows as $row) {
$cells = $row->elementsByName("cell");
// Определяем код авиакомпании и номер рейса
preg_match_all("/([A-Za-zА-Яа-я0-9]{2})[\\s]*([0-9]+)/", $cells[0]->content, $flightNumber, PREG_PATTERN_ORDER);
$result["FLIGHTS"][] = array("FLIGHT" => array("AK_CODE" => $flightNumber[1][0], "NUMBER" => $flightNumber[2][0]), "AK_NAME" => htmlspecialcharsEx($cells[1]->content), "DEPARTURE" => htmlspecialcharsEx($cells[2]->content), "ARRIVAL" => htmlspecialcharsEx($cells[3]->content), "STATUS" => CAirportBoard::GetStatusInfo($cells[4]->content), "TIME" => array("PLANNED" => CAirportBoard::GetDateTimeArray($cells[5]->content), "ESTIMATED" => CAirportBoard::GetDateTimeArray($cells[6]->content), "ACTUAL" => CAirportBoard::GetDateTimeArray($cells[7]->content)), "TERMINAL" => htmlspecialcharsEx($cells[8]->content));
// Формируем список уникальных авиакомпаний, терминалов и пунктов вылета и прилета для фильтра
if (!in_array(htmlspecialcharsEx($cells[1]->content), $akNames)) {
$akNames[] = htmlspecialcharsEx($cells[1]->content);
}
if (!in_array($flightNumber[1][0], $akCodes)) {
$akCodes[] = $flightNumber[1][0];
}
if (!in_array(htmlspecialcharsEx($cells[2]->content), $departures)) {
$departures[] = htmlspecialcharsEx($cells[2]->content);
}
if (!in_array(htmlspecialcharsEx($cells[3]->content), $arrivals)) {
$arrivals[] = htmlspecialcharsEx($cells[3]->content);
}
if (!in_array(htmlspecialcharsEx($cells[8]->content), $terminals)) {
$terminals[] = htmlspecialcharsEx($cells[8]->content);
}
}
sort($akNames);
sort($akCodes);
sort($departures);
sort($arrivals);
sort($terminals);
$result["AK_NAMES"] = $akNames;
$result["AK_CODES"] = $akCodes;
$result["DEPARTURES"] = $departures;
$result["ARRIVALS"] = $arrivals;
$result["TERMINALS"] = $terminals;
}
}
return $result;
}
示例4: GetOneBoardFromSite
function GetOneBoardFromSite($queryParameters, $addQueryParameters)
{
global $APPLICATION;
$ob = new CHTTP();
$ob->http_timeout = 60;
$ob->Query("GET", "www.pulkovoairport.ru", 80, "/online_serves/online_timetable/" . $queryParameters . '?ts=' . mktime() . (strlen($addQueryParameters) ? '&' . $addQueryParameters : ''), false, "", "N");
$res = $APPLICATION->ConvertCharset($ob->result, "KOI8-R", SITE_CHARSET);
$res = str_replace('<table class="tablo tabloBigNew bigTableZebra" border="0">', "++++", $res);
$res = str_replace('</div> <!-- / gridTbox -->', "++++", $res);
$explode = explode("++++", $res);
$res = $explode[1];
$res = substr($res, 0, strlen($res) - 22);
return array("ERROR" => array("CODE" => $ob->errno, "MESSAGE" => $ob->errstr), "HTML" => $res);
unset($explode, $res);
}
示例5: GetOneBoardFromSite
function GetOneBoardFromSite($queryParameters, $addQueryParameters)
{
global $APPLICATION;
$ob = new CHTTP();
$ob->http_timeout = 60;
$ob->Query("GET", "www.domodedovo.ru", 80, "/onlinetablo/?" . $queryParameters . (strlen($addQueryParameters) ? '&' . $addQueryParameters : '') . '&ts=' . mktime(), false, "", "N");
$res = $APPLICATION->ConvertCharset($ob->result, "UTF-8", SITE_CHARSET);
$res = str_replace('<table cellspacing="1" cellpadding="3" width="100%" border="0" id="onlinetablo" >', "++++", $res);
$res = str_replace('</form>', "++++", $res);
$explode = explode("++++", $res);
$res = $explode[1];
$res = str_replace('</table>', "++++", $res);
$explode = explode("++++", $res);
$res = $explode[0];
return array("ERROR" => array("CODE" => $ob->errno, "MESSAGE" => $ob->errstr), "HTML" => $res);
unset($explode, $res);
}
示例6: createFile
public function createFile(array $fileData)
{
$accessToken = $this->getAccessToken();
$mimeType = $fileData['mimeType'];
$fileSrc = $fileData['src'];
$fileName = $fileData['name'];
CWebDavTools::convertToUtf8($fileName);
$fileSize = $fileData['size'] ? $fileData['size'] : filesize($fileSrc);
$content = file_get_contents($fileSrc);
$http = new CHTTP();
$http->http_timeout = 10;
$fileName = urlencode($fileName);
$arUrl = $http->ParseURL("https://apis.live.net/v5.0/me/skydrive/files/{$fileName}?access_token=" . urlencode($accessToken));
if (!$http->Query('PUT', $arUrl['host'], $arUrl['port'], $arUrl['path_query'], $content, $arUrl['proto'], '')) {
return false;
}
$this->checkHttpResponse($http);
// error checking
if ($http->status != '200' && $http->status != '201') {
return false;
}
return json_decode($http->result, true);
}
示例7: SendCommand
private static function SendCommand($channelId, $message, $method = 'POST', $timeout = 5, $dont_wait_answer = true)
{
if (!is_array($channelId))
$channelId = Array($channelId);
$channelId = implode('/', array_unique($channelId));
if (strlen($channelId) <=0 || strlen($message) <= 0)
return false;
if (!in_array($method, Array('POST', 'GET')))
return false;
$nginx_error = COption::GetOptionString("pull", "nginx_error", "N");
if ($nginx_error != "N")
{
$nginx_error = unserialize($nginx_error);
if (intval($nginx_error['date'])+120 < time())
{
COption::SetOptionString("pull", "nginx_error", "N");
CAdminNotify::DeleteByTag("PULL_ERROR_SEND");
$nginx_error = "N";
}
else if ($nginx_error['count'] >= 10)
{
$ar = Array(
"MESSAGE" => GetMessage('PULL_ERROR_SEND'),
"TAG" => "PULL_ERROR_SEND",
"MODULE_ID" => "pull",
);
CAdminNotify::Add($ar);
return false;
}
}
$postdata = CHTTP::PrepareData($message);
$CHTTP = new CHTTP();
$CHTTP->http_timeout = intval($timeout);
$arUrl = $CHTTP->ParseURL(CPullOptions::GetPublishUrl($channelId), false);
if ($CHTTP->Query($method, $arUrl['host'], $arUrl['port'], $arUrl['path_query'], $postdata, $arUrl['proto'], 'N', $dont_wait_answer))
{
$result = $dont_wait_answer? '{}': $CHTTP->result;
}
else
{
if ($nginx_error == "N")
{
$nginx_error = Array(
'count' => 1,
'date' => time(),
'date_increment' => time(),
);
}
else if (intval($nginx_error['date_increment'])+1 < time())
{
$nginx_error['count'] = intval($nginx_error['count'])+1;
$nginx_error['date_increment'] = time();
}
COption::SetOptionString("pull", "nginx_error", serialize($nginx_error));
$result = false;
}
return $result;
}
示例8: Calculate
function Calculate($profile, $arConfig, $arOrder, $STEP)
{
if ($STEP >= 3) {
return array("RESULT" => "ERROR", "TEXT" => GetMessage('SALE_DH_CPCR_ERROR_CONNECT'));
}
$arOrder["WEIGHT"] = CSaleMeasure::Convert($arOrder["WEIGHT"], "G", "KG");
if ($arOrder["WEIGHT"] <= 0) {
$arOrder["WEIGHT"] = 1;
}
// weight must not be null - let it be 1 kg
$arLocationFrom = CDeliveryCPCR::__GetLocation($arOrder["LOCATION_FROM"]);
$arLocationTo = CDeliveryCPCR::__GetLocation($arOrder["LOCATION_TO"]);
// caching is dependent from category, locations "from" & "to" and from weight interval
$cache_id = "sale3|9.5.0|cpcr|" . $arConfig["category"]['VALUE'] . "|" . $arLocationFrom["ORIGINAL"]["COUNTRY_ID"] . "|" . $arLocationFrom["ORIGINAL"]["CITY_ID"] . "|" . $arLocationTo["ORIGINAL"]["COUNTRY_ID"] . "|" . $arLocationTo["ORIGINAL"]["CITY_ID"];
if ($arOrder["WEIGHT"] <= 0.5) {
$cache_id .= "|0";
} elseif ($arOrder["WEIGHT"] <= 1) {
$cache_id .= "|1";
} else {
$cache_id .= "|" . ceil($arOrder["WEIGHT"]);
}
// other intervals - up to next natural number
$obCache = new CPHPCache();
if ($obCache->InitCache(DELIVERY_CPCR_CACHE_LIFETIME, $cache_id, "/")) {
// cache found
$vars = $obCache->GetVars();
$arResult = $vars["RESULT"];
} else {
// format HTTP query request data
$arQuery = array();
$arQuery[] = DELIVERY_CPCR_SERVER_POST_FROM_COUNTRY . "=" . urlencode($arLocationFrom["COUNTRY"]);
if (is_set($arLocationFrom["CITY_ID"])) {
$arQuery[] = DELIVERY_CPCR_SERVER_POST_FROM_CITY . "=" . urlencode($arLocationFrom["CITY_ID"]);
} else {
$arQuery[] = DELIVERY_CPCR_SERVER_POST_FROM_CITY_NAME . "=" . urlencode($GLOBALS['APPLICATION']->ConvertCharset($arLocationFrom["CITY"], LANG_CHARSET, 'windows-1251'));
}
$arQuery[] = DELIVERY_CPCR_SERVER_POST_WEIGHT . "=" . urlencode($arOrder["WEIGHT"]);
$arQuery[] = DELIVERY_CPCR_SERVER_POST_CATEGORY . "=" . "1";
//urlencode($arConfig["category"]["VALUE"]);
// price coefficient will be added later - to make caching independent from price
$arQuery[] = DELIVERY_CPCR_SERVER_POST_PRICE . "=0";
$arQuery[] = DELIVERY_CPCR_SERVER_POST_TO_COUNTRY . "=" . urlencode($arLocationTo["COUNTRY"]);
/*
if (is_set($arLocationTo["REGION"]))
$arQuery[] = DELIVERY_CPCR_SERVER_POST_TO_REGION."=".urlencode($arLocationTo["REGION"]);
else
$arQuery[] = DELIVERY_CPCR_SERVER_POST_TO_REGION."=".urlencode(DELIVERY_CPCR_CITY_DEFAULT);
*/
if (is_set($arLocationTo["CITY_ID"])) {
$arQuery[] = DELIVERY_CPCR_SERVER_POST_TO_CITY . "=" . urlencode($arLocationTo["CITY_ID"]);
} else {
$arQuery[] = DELIVERY_CPCR_SERVER_POST_TO_CITY_NAME . "=" . urlencode($GLOBALS['APPLICATION']->ConvertCharset($arLocationTo["CITY"], LANG_CHARSET, 'windows-1251'));
}
CDeliveryCPCR::__Write2Log(print_r($arLocationTo, true));
$arQuery[] = DELIVERY_CPCR_SERVER_POST_ADDITIONAL;
$query_string = implode("&", $arQuery);
$query_page = DELIVERY_CPCR_SERVER_PAGE;
// get data from server
$ob = new CHTTP();
$ob->http_timeout = 50;
$data = $ob->Query(DELIVERY_CPCR_SERVER_METHOD, DELIVERY_CPCR_SERVER, DELIVERY_CPCR_SERVER_PORT, $query_page . (DELIVERY_CPCR_SERVER_METHOD == 'GET' ? (strpos($query_page, '?') === false ? '?' : '&') . $query_string : ''), DELIVERY_CPCR_SERVER_METHOD == 'POST' ? $query_string : false);
if ($data) {
$data = $GLOBALS["APPLICATION"]->ConvertCharset($ob->result, 'windows-1251', LANG_CHARSET);
}
CDeliveryCPCR::__Write2Log($query_page);
CDeliveryCPCR::__Write2Log($query_string);
CDeliveryCPCR::__Write2Log($error_number . ": " . $error_text);
CDeliveryCPCR::__Write2Log($data);
if (strpos($data, "<?xml") === false) {
return array("RESULT" => "ERROR", "TEXT" => GetMessage('SALE_DH_CPCR_ERROR_CONNECT'));
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/xml.php";
$objXML = new CDataXML();
$objXML->LoadString($data);
$arResult = $objXML->GetArray();
$arProfiles = array('SIMPLE' => '"цеоюпд-щйяопеяя"', 'ECONOM' => '"оекхйюм-ярюмдюпр"', 'SIMPLE13' => '"цеоюпд-щйяопеяя 13"', 'SIMPLE18' => '"цеоюпд-щйяопеяя 18"', 'BIZON' => '"ахгнм-йюпцн"', 'COLIBRI' => '"йнкхапх-днйслемр"', 'PELICAN' => '"оекхйюм-нмкюим"', 'FRAXT' => '"тпюур"');
$arTmpResult = array();
if (isset($arResult["root"]["#"]["Error"]) and is_array($arResult["root"]["#"]["Error"])) {
return array("RESULT" => "ERROR", "TEXT" => GetMessage('SALE_DH_CPCR_ERROR_CONNECT') . ' (' . htmlspecialcharsbx(strip_tags($arResult["root"]["#"]["Tariff"][0]["#"]["TariffType"][0]["#"])) . ')');
} else {
if (!empty($arResult["root"]["#"]["Tariff"])) {
foreach ($arResult["root"]["#"]["Tariff"] as $key => $val) {
foreach ($val["#"] as $k => $v) {
foreach ($arProfiles as $prof => $title) {
if (ToUpper($v[0]["#"]) == ToUpper($title)) {
$arTmpResult[ToLower($prof)] = array('VALUE' => $val["#"]["Total_Dost"][0]["#"], 'TRANSIT' => $val["#"]["DP"][0]["#"]);
unset($arProfiles[$prof]);
break;
}
}
}
}
}
$arResult = $arTmpResult;
if (count($arTmpResult) > 0) {
$obCache->StartDataCache();
$obCache->EndDataCache(array("RESULT" => $arResult));
} else {
return array("RESULT" => "ERROR", "TEXT" => GetMessage('SALE_DH_CPCR_ERROR_CONNECT'));
}
//.........这里部分代码省略.........
示例9: GetBoardFromSite
function GetBoardFromSite()
{
$result = array();
global $APPLICATION;
$ob = new CHTTP();
$ob->http_timeout = 60;
$ob->Query("GET", "svo.aero", 80, "/timetable/today/?ts=" . mktime(), false, "", "N");
$result["ERROR"] = array("CODE" => $ob->errno, "MESSAGE" => $ob->errstr);
$res = $APPLICATION->ConvertCharset($ob->result, "UTF-8", SITE_CHARSET);
$res = str_replace('</thead><tbody>', "++++", $res);
$res = str_replace('</tr></tbody></table></div>', "</tr>++++", $res);
$explode = explode("++++", $res);
$res = '<table>' . $explode[1] . '</table>';
$resPatterns = array("/<a[^>]*>/Uis", "/<\\/a>/Uis");
$resReplace = array("", "");
$res = preg_replace($resPatterns, $resReplace, $res);
//trace($res);
if (!intval($result["ERROR"]["CODE"])) {
$result["INBOUND"]["AK_NAMES"] = array();
$result["INBOUND"]["AK_CODES"] = array();
$result["INBOUND"]["DEPARTURES"] = array();
$result["INBOUND"]["ARRIVALS"] = array();
$result["INBOUND"]["TERMINALS"] = array();
$result["OUTBOUND"]["AK_NAMES"] = array();
$result["OUTBOUND"]["AK_CODES"] = array();
$result["OUTBOUND"]["DEPARTURES"] = array();
$result["OUTBOUND"]["ARRIVALS"] = array();
$result["OUTBOUND"]["TERMINALS"] = array();
$xml = new CDataXML();
if ($xml->LoadString($res)) {
$node = $xml->SelectNodes("/table");
$rows = $node->elementsByName("tr");
$i = 0;
foreach ($rows as $row) {
$boardType = strstr($row->getAttribute("class"), "sA") ? "INBOUND" : (strstr($row->getAttribute("class"), "sD") ? "OUTBOUND" : false);
if ($boardType) {
$cells = $row->elementsByName("td");
if (count($cells)) {
$img = $cells[4]->elementsByName("img");
preg_match_all("/([0-9]{1,2}:[0-9]{1,2})/", $cells[7]->content, $timeFromStatus, PREG_PATTERN_ORDER);
preg_match_all("/^([а-я]+)\\s*/i", $cells[7]->content, $status, PREG_PATTERN_ORDER);
$result[$boardType]["FLIGHTS"][$i] = array("FLIGHT" => array("AK_CODE" => $cells[2]->content, "NUMBER" => $cells[3]->content), "AK_NAME" => count($img) ? htmlspecialcharsEx($img[0]->getAttribute("alt")) : "", "DEPARTURE" => htmlspecialcharsEx($cells[5]->content), "ARRIVAL" => htmlspecialcharsEx($cells[5]->content), "STATUS" => CAirportBoard::GetStatusInfo($status), "TIME" => array("PLANNED" => CAirportBoard::GetDateTimeArray($cells[1]->content, $cells[0]->content), "ESTIMATED" => strpos($cells[7]->content, "задерживается") !== false || strpos($cells[7]->content, "ожидается") !== false ? CAirportBoard::GetDateTimeArray($timeFromStatus[1][0]) : "", "ACTUAL" => strpos($cells[7]->content, "совершил посадку") !== false || strpos($cells[7]->content, "прибыл") !== false || strpos($cells[7]->content, "вылетел") !== false || strpos($cells[7]->content, "отправлен") !== false ? CAirportBoard::GetDateTimeArray($timeFromStatus[1][0]) : ""), "TERMINAL" => $cells[6]->content);
// Формируем список уникальных терминалов и пунктов вылета и прилета для фильтра
if (!in_array($result[$boardType]["FLIGHTS"][$i]["FLIGHT"]["AK_CODE"], $result[$boardType]["AK_CODES"])) {
$result[$boardType]["AK_CODES"][] = $result[$boardType]["FLIGHTS"][$i]["FLIGHT"]["AK_CODE"];
}
if (!in_array($result[$boardType]["FLIGHTS"][$i]["AK_NAME"], $result[$boardType]["AK_NAMES"]) && strlen($result[$boardType]["FLIGHTS"][$i]["AK_NAME"])) {
$result[$boardType]["AK_NAMES"][] = $result[$boardType]["FLIGHTS"][$i]["AK_NAME"];
}
if (!in_array($result[$boardType]["FLIGHTS"][$i]["DEPARTURE"], $result[$boardType]["DEPARTURES"])) {
$result[$boardType]["DEPARTURES"][] = $result[$boardType]["FLIGHTS"][$i]["DEPARTURE"];
}
if (!in_array($result[$boardType]["FLIGHTS"][$i]["ARRIVAL"], $result[$boardType]["ARRIVALS"])) {
$result[$boardType]["ARRIVALS"][] = $result[$boardType]["FLIGHTS"][$i]["ARRIVAL"];
}
if (!in_array($result[$boardType]["FLIGHTS"][$i]["TERMINAL"], $result[$boardType]["TERMINALS"])) {
$result[$boardType]["TERMINALS"][] = $result[$boardType]["FLIGHTS"][$i]["TERMINAL"];
}
$i++;
}
}
}
}
sort($result["INBOUND"]["AK_NAMES"]);
sort($result["INBOUND"]["AK_CODES"]);
sort($result["INBOUND"]["DEPARTURES"]);
sort($result["INBOUND"]["ARRIVALS"]);
sort($result["INBOUND"]["TERMINALS"]);
sort($result["OUTBOUND"]["AK_NAMES"]);
sort($result["OUTBOUND"]["AK_CODES"]);
sort($result["OUTBOUND"]["DEPARTURES"]);
sort($result["OUTBOUND"]["ARRIVALS"]);
sort($result["OUTBOUND"]["TERMINALS"]);
/*
// Сортируем рейсы по абсолютному времени вылета
SortFreeStyleArray( $result["FLIGHTS"], Array(
'["TIME"]["PLANNED"]["DATETIME"]' => 'ASC',
'["FLIGHT"]' => 'ASC'
)
);
*/
//trace($result);
}
return $result;
}
示例10: QueryGetData
function QueryGetData($SITE, $PORT, $PATH, $QUERY_STR, &$errno, &$errstr, $sMethod="GET", $sProto="", $sContentType = 'N')
{
$ob = new CHTTP();
$ob->Query(
$sMethod,
$SITE,
$PORT,
$PATH . ($sMethod == 'GET' ? ((strpos($PATH, '?') === false ? '?' : '&') . $QUERY_STR) : ''),
$sMethod == 'POST' ? $QUERY_STR : false,
$sProto,
$sContentType
);
$errno = $ob->errno;
$errstr = $ob->errstr;
return $ob->result;
}
示例11: Query
private function Query($command, $params = array())
{
if (strlen($command) <= 0 || !is_array($params)) {
return false;
}
$params['BX_COMMAND'] = $command;
$params['BX_LICENCE'] = $this->licenceCode;
$params['BX_DOMAIN'] = $this->domain;
$params['BX_TYPE'] = $this->type;
$params['BX_VERSION'] = $this->version;
$params["BX_HASH"] = $this->RequestSign($this->type, md5(implode("|", $params)));
$CHTTP = new CHTTP();
$arUrl = $CHTTP->ParseURL($this->controllerUrl);
if ($CHTTP->Query('POST', $arUrl['host'], $arUrl['port'], $arUrl['path_query'], CHTTP::PrepareData($params), $arUrl['proto'])) {
$result = json_decode($CHTTP->result);
if (!$result) {
CVoxImplantHistory::WriteToLog($CHTTP->result, 'ERROR QUERY EXECUTE');
}
} else {
$result = json_decode(json_encode(array('error' => array('code' => 'CONNECT_ERROR', 'msg' => 'Parse error or connect error from server'))));
}
return $result;
}
示例12: SendCommand
private static function SendCommand($channelId, $message, $options = array())
{
if (!is_array($channelId)) {
$channelId = array($channelId);
}
$channelId = implode('/', array_unique($channelId));
if (strlen($channelId) <= 0 || strlen($message) <= 0) {
return false;
}
$defaultOptions = array("method" => "POST", "timeout" => 5, "dont_wait_answer" => true);
$options = array_merge($defaultOptions, $options);
if (!in_array($options["method"], array('POST', 'GET'))) {
return false;
}
$nginx_error = COption::GetOptionString("pull", "nginx_error", "N");
if ($nginx_error != "N") {
$nginx_error = unserialize($nginx_error);
if (intval($nginx_error['date']) + 120 < time()) {
COption::SetOptionString("pull", "nginx_error", "N");
CAdminNotify::DeleteByTag("PULL_ERROR_SEND");
$nginx_error = "N";
} else {
if ($nginx_error['count'] >= 10) {
$ar = array("MESSAGE" => GetMessage('PULL_ERROR_SEND'), "TAG" => "PULL_ERROR_SEND", "MODULE_ID" => "pull");
CAdminNotify::Add($ar);
return false;
}
}
}
$postdata = CHTTP::PrepareData($message);
$CHTTP = new CHTTP();
$CHTTP->http_timeout = intval($options["timeout"]);
if (isset($options["expiry"])) {
$CHTTP->SetAdditionalHeaders(array("Message-Expiry" => intval($options["expiry"])));
}
$arUrl = $CHTTP->ParseURL(CPullOptions::GetPublishUrl($channelId), false);
try {
$sendResult = $CHTTP->Query($options["method"], $arUrl['host'], $arUrl['port'], $arUrl['path_query'], $postdata, $arUrl['proto'], 'N', $options["dont_wait_answer"]);
} catch (Exception $e) {
$sendResult = false;
}
if ($sendResult) {
$result = $options["dont_wait_answer"] ? '{}' : $CHTTP->result;
} else {
if ($nginx_error == "N") {
$nginx_error = array('count' => 1, 'date' => time(), 'date_increment' => time());
} else {
if (intval($nginx_error['date_increment']) + 1 < time()) {
$nginx_error['count'] = intval($nginx_error['count']) + 1;
$nginx_error['date_increment'] = time();
}
}
COption::SetOptionString("pull", "nginx_error", serialize($nginx_error));
$result = false;
}
return $result;
}
示例13:
$data=CUtil::JsObjectToPhp($_REQUEST['data']);
$req=new CHTTP;
$req->SetAuthBasic($data['login'],$data['pass']);
$URL=$data['url'];
if (!$data['phpsessid'])
$URL.='?mode=checkauth&type=catalog';
else
{
$URL.='?mode=import&type=catalog&filename='.$data['filename'];
$req->additional_headers['Cookie'] = 'PHPSESSID='.$data['phpsessid'].';';
}
$arUrl=$req->ParseURL($URL);
$req->Query('GET',$arUrl['host'],$arUrl['port'],$arUrl['path_query']);
$body=explode("\n",$req->result);
if (count($body)>1)
{
$response['status']=$body[0];
if ($response['status']=='success' && $body[1]=='PHPSESSID')
$response['phpsessid']=$body[2];
else
{
if (ToUpper($req->headers['Content-Type'])!=ToUpper('text/html; charset=utf-8'))
$body=$APPLICATION->ConvertCharsetArray($body,'windows-1251','UTF-8');
$response['text']=$body[1];
}
示例14: ParseDateTime
} else {
$arRATE_DAY_PARSED = ParseDateTime($arParams["RATE_DAY"], "YYYY-MM-DD");
$arRATE_DAY_PARSED['YYYY'] = intval($arRATE_DAY_PARSED['YYYY']);
if (1901 > $arRATE_DAY_PARSED["YYYY"] || 2038 < $arRATE_DAY_PARSED["YYYY"]) {
$arResult["RATE_DAY_TIMESTAMP"] = time();
$arResult["RATE_DAY_SHOW"] = ConvertTimeStamp($arResult["RATE_DAY_TIMESTAMP"], 'SHORT');
} else {
$arResult["RATE_DAY_TIMESTAMP"] = mktime(0, 0, 0, $arRATE_DAY_PARSED["MM"], $arRATE_DAY_PARSED["DD"], $arRATE_DAY_PARSED["YYYY"]);
$arResult["RATE_DAY_SHOW"] = ConvertTimeStamp($arResult["RATE_DAY_TIMESTAMP"], 'SHORT');
}
}
if (!empty($arParams["arrCURRENCY_FROM"])) {
if ('Y' == $arParams["SHOW_CB"]) {
$bWarning = false;
$obHttp = new CHTTP();
$obHttp->Query('GET', 'www.cbr.ru', 80, "/scripts/XML_daily.asp?date_req=" . date("d.m.Y", $arResult["RATE_DAY_TIMESTAMP"]), false, '', 'N');
$strQueryText = $obHttp->result;
if (empty($strQueryText)) {
$bWarning = true;
}
if (!$bWarning) {
if (SITE_CHARSET != "windows-1251") {
$strQueryText = $APPLICATION->ConvertCharset($strQueryText, "windows-1251", SITE_CHARSET);
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/xml.php";
$strQueryText = preg_replace("#<!DOCTYPE[^>]+?>#i", "", $strQueryText);
$strQueryText = preg_replace("#<" . "\\?XML[^>]+?\\?" . ">#i", "", $strQueryText);
$objXML = new CDataXML();
$objXML->LoadString($strQueryText);
$arData = $objXML->GetArray();
$arFields = array();
示例15: sendBatch
public function sendBatch($batch)
{
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/update_client.php";
$key = CUpdateClient::GetLicenseKey();
if (strlen($key) > 0 && strlen($batch) > 0) {
$request = new CHTTP();
$arPostData = array("Action" => "SendMessage", "MessageBody" => $batch);
$postdata = CHTTP::PrepareData($arPostData);
$arUrl = $request->ParseURL(self::$remoteProviderUrl . "?key=" . md5($key), false);
$request->Query('POST', $arUrl['host'], $arUrl['port'], $arUrl['path_query'], $postdata, $arUrl['proto'], 'N', true);
return true;
}
return false;
}