本文整理汇总了PHP中QueryGetData函数的典型用法代码示例。如果您正苦于以下问题:PHP QueryGetData函数的具体用法?PHP QueryGetData怎么用?PHP QueryGetData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QueryGetData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: request
function request($url, $body)
{
// TODO: check errno and result
$errno = "";
$errstr = "";
$info = parse_url($url);
// TODO: check for false
return QueryGetData($info['host'], 443, $info['path'], $body, $errno, $errstr, "POST", "ssl://");
}
示例2: elseif
//ukraina
$host = "pfsoft.com.ua";
$path = "/service/currency/";
$QUERY_STR = "date=" . $DB->FormatDate($DATE_RATE, CLang::GetDateFormat("SHORT", $lang), "DMY");
} elseif ($currantCurrancy == "BYR") {
//belarus
$host = "www.nbrb.by";
$path = "/Services/XmlExRates.aspx";
$QUERY_STR = "ondate=" . $DB->FormatDate($DATE_RATE, CLang::GetDateFormat("SHORT", $lang), "Y-M-D");
} else {
//all time russia
$host = "www.cbr.ru";
$path = "/scripts/XML_daily.asp";
$QUERY_STR = "date_req=" . $DB->FormatDate($DATE_RATE, CLang::GetDateFormat("SHORT", $lang), "D.M.Y");
}
$strQueryText = QueryGetData($host, $port, $path, $QUERY_STR, $errno, $errstr);
if (strlen($strQueryText) <= 0) {
if (intval($errno) > 0 || strlen($errstr) > 0) {
$strError = GetMessage("ERROR_QUERY_RATE");
} else {
$strError = GetMessage("ERROR_EMPTY_ANSWER");
}
} else {
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/xml.php";
$charset = "windows-1251";
if (preg_match("/<" . "\\?XML[^>]{1,}encoding=[\"']([^>\"']{1,})[\"'][^>]{0,}\\?" . ">/i", $strQueryText, $matches)) {
$charset = trim($matches[1]);
}
$strQueryText = preg_replace("#<!DOCTYPE[^>]+?>#i", "", $strQueryText);
$strQueryText = preg_replace("#<" . "\\?XML[^>]+?\\?" . ">#i", "", $strQueryText);
$strQueryText = $APPLICATION->ConvertCharset($strQueryText, $charset, SITE_CHARSET);
示例3: either
$user_id = (int)$GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["USER_ID"];
$sum = (float)either(
CSalePaySystemAction::GetParamValue("SHOULD_PAY"),
$GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"]);
$orderid = (int)either(
CSalePaySystemAction::GetParamValue("ORDER_ID"),
$GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ID"]);
$email = either($GLOBALS["SALE_INPUT_PARAMS"]["PROPERTY"]["EMAIL"], $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["USER_EMAIL"]);
$phone = htmlspecialchars($GLOBALS['SALE_INPUT_PARAMS']['PROPERTY']['PHONE']);
// --- BEGIN --- костыль для arteva
$arOrder = getOrder($orderid);
$user_id = $arOrder["ACCOUNT_NUMBER"]; // вместо пользователя передаём номер заказа (не ID)
// --- END ---
$opts = array ("sum"=>$sum, "user_id"=>$user_id);
$payment_parameters = array("clientid"=>$user_id, "orderid"=>$orderid, "sum"=>$sum, "phone"=>$phone, "email"=>$email);
$query = http_build_query($payment_parameters);
$err_num = $err_text = NULL;
$form = QueryGetData($TMG_PK_SERVER_ADDR, 80, "/external/", $query, $err_num, $err_text);
if ($form == "")
$form = "<h3>Произошла ошибка при инциализации платежа</h3><p>$err_num: ".htmlspecialchars($err_text)."</p>";
?>
<div id='tmg_pk_form_container'>
<?php
echo $form;
?>
</div>
示例4: urlencode
}
}
// Transaction Data
$strPostQueryString .= "&x_amount=" . urlencode($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"]);
$strPostQueryString .= "&x_currency_code=" . urlencode($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"]);
$strPostQueryString .= "&x_method=CC";
$strPostQueryString .= "&x_type=AUTH_CAPTURE";
$strPostQueryString .= "&x_recurring_billing=NO";
$strPostQueryString .= "&x_card_num=" . urlencode($INPUT_CARD_NUM);
$strPostQueryString .= "&x_exp_date=" . urlencode($INPUT_CARD_EXP_MONTH . $INPUT_CARD_EXP_YEAR);
// MMYYYY
$strPostQueryString .= "&x_card_code=" . urlencode($INPUT_CARD_CODE);
// Level 2 Data
$strPostQueryString .= "&x_tax=" . urlencode($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["TAX_VALUE"]);
$strPostQueryString .= "&x_freight=" . urlencode($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PRICE_DELIVERY"]);
$strResult = QueryGetData("secure.authorize.net", 443, "/gateway/transact.dll", $strPostQueryString, $errno, $errstr, "POST", "ssl://");
$mass = explode("|,|", "|," . $strResult);
$strHashValue = CSalePaySystemAction::GetParamValue("HASH_VALUE");
if (strlen($strHashValue) > 0) {
if (md5($strHashValue . CSalePaySystemAction::GetParamValue("PS_LOGIN") . $mass[7] . sprintf("%.2f", $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"])) != strtolower($mass[38])) {
$mass = array();
$mass[1] = 3;
$mass[4] = "MD5 transaction signature is incorrect!";
$mass[3] = 0;
$mass[2] = 0;
}
}
$strPS_STATUS = IntVal($mass[1]) == 1 ? "Y" : "N";
$strPS_STATUS_CODE = $mass[3];
if ($strPS_STATUS == "Y") {
$strPS_STATUS_DESCRIPTION = "Approval Code: " . $mass[5] . (!empty($mass[7]) ? "; Transaction ID: " . $mass[7] : "");
示例5: Calculate
function Calculate($profile, $arConfig, $arOrder, $STEP, $TEMP = false)
{
if ($STEP >= 3) {
return array("RESULT" => "ERROR", "TEXT" => GetMessage('SALE_DH_RUSSIANPOST_ERROR_CONNECT'));
}
if ($arOrder["WEIGHT"] <= 0) {
$arOrder["WEIGHT"] = 1;
}
$arLocationFrom = CDeliveryRUSSIANPOST::__GetLocation($arOrder["LOCATION_FROM"]);
if ($arOrder['LOCATION_ZIP']) {
$arLocationTo = CDeliveryRUSSIANPOST::__GetLocation($arOrder["LOCATION_TO"]);
$arLocationTo['ZIP'] = array(0 => $arOrder['LOCATION_ZIP']);
} else {
$arLocationTo = CDeliveryRUSSIANPOST::__GetLocation($arOrder["LOCATION_TO"], true);
}
$zip = COption::GetOptionString('sale', 'location_zip');
if (strlen($zip) > 0) {
$arLocationFrom["ZIP"] = array(0 => $zip);
}
if ($arLocationTo["IS_RUSSIAN"] == 'Y' && count($arLocationTo["ZIP"]) <= 0) {
return array("RESULT" => "ERROR", "TEXT" => GetMessage('SALE_DH_RUSSIANPOST_ERROR_NOZIP'));
}
$cache_id = "sale|8.0.3|russianpost|" . $profile . "|" . $arConfig["category"]["VALUE"] . "|" . $arOrder["LOCATION_FROM"] . "|" . ($arLocationTo["IS_RUSSIAN"] == 'Y' ? $arLocationTo["ZIP"][0] : $arOrder["LOCATION_TO"]);
if (in_array($arConfig["category"]["VALUE"], array(23, 12, 13, 26, 16))) {
$cache_id .= "|" . ceil(CSaleMeasure::Convert($arOrder["WEIGHT"], "G", "KG") / 0.5);
} else {
$cache_id .= "|" . ceil(CSaleMeasure::Convert($arOrder["WEIGHT"], "G", "KG") / 500);
}
$obCache = new CPHPCache();
if ($obCache->InitCache(DELIVERY_RUSSIANPOST_CACHE_LIFETIME, $cache_id, "/")) {
$vars = $obCache->GetVars();
$result = $vars["RESULT"];
// only these delivery types have insurance tax of 3% or 4% from price
if (in_array($arConfig["category"]["VALUE"], array(26, 16))) {
$result += $arOrder["PRICE"] * DELIVERY_RUSSIANPOST_PRICE_TARIFF;
} elseif ($arConfig["category"]["VALUE"] == 36) {
$result += $arOrder["PRICE"] * DELIVERY_RUSSIANPOST_PRICE_TARIFF_1;
}
return array("RESULT" => "OK", "VALUE" => $result);
}
$arQuery = array();
$arProfile = array("ground" => 1, "avia" => 2);
if ($arLocationTo["IS_RUSSIAN"] == "Y") {
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_CATEGORY . "=" . urlencode($arConfig["category"]["VALUE"]);
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_CATEGORY_NAME . "=" . urlencode(GetMessage("SALE_DH_RUSSIANPOST_CONFIG_CATEGORY_" . $arConfig["category"]["VALUE"]));
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_PROFILE . "=" . urlencode($arProfile[$profile]);
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_PROFILE_NAME . '=' . urlencode(GetMessage("SALE_DH_RUSSIANPOST_" . ToUpper($profile)));
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_COUNTRY . "=643";
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_COUNTRY_NAME . '=' . urlencode($GLOBALS['APPLICATION']->ConvertCharset('Российская Федерация', LANG_CHARSET, 'utf-8'));
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_WEIGHT . "=" . urlencode($arOrder["WEIGHT"]);
// price does not affect on half of delivery types. others have 3% or 4% insurance tax which is ignored here for caching and used later.
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_PRICE . "=0";
// if (!in_array($arConfig["category"]["VALUE"], array(26, 36, 16)))
// {
// $arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_PRICE."=".urlencode(round($arOrder["PRICE"]));
// }
// else
// {
// $arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_PRICE."=0";
// }
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_ZIP . "=" . urlencode($arLocationTo["ZIP"][0]);
} else {
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_CATEGORY . "=" . urlencode($arConfig["category"]["VALUE"]);
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_CATEGORY_NAME . "=" . urlencode(GetMessage("SALE_DH_RUSSIANPOST_CONFIG_CATEGORY_" . $arConfig["category"]["VALUE"]));
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_PROFILE . "=" . urlencode($arProfile[$profile]);
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_PROFILE_NAME . '=' . urlencode(GetMessage("SALE_DH_RUSSIANPOST_" . ToUpper($profile)));
$arCountry = CDeliveryRUSSIANPOST::__GetCountry($arLocationTo);
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_COUNTRY . "=" . urlencode($arCountry["ID"]);
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_COUNTRY_NAME . "=" . urlencode($GLOBALS['APPLICATION']->ConvertCharset($arCountry["NAME"], LANG_CHARSET, 'utf-8'));
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_WEIGHT . "=" . urlencode($arOrder["WEIGHT"]);
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_PRICE . "=0";
$arQuery[] = DELIVERY_RUSSIANPOST_SERVER_POST_ZIP . "=0";
}
$data = QueryGetData(DELIVERY_RUSSIANPOST_SERVER, DELIVERY_RUSSIANPOST_SERVER_PORT, DELIVERY_RUSSIANPOST_SERVER_PAGE, implode("&", $arQuery), $error_number = 0, $error_text = "", DELIVERY_RUSSIANPOST_SERVER_METHOD);
$data = $GLOBALS['APPLICATION']->ConvertCharset($data, 'utf-8', LANG_CHARSET);
CDeliveryRUSSIANPOST::__Write2Log($error_number . ": " . $error_text);
CDeliveryRUSSIANPOST::__Write2Log($data);
if (strlen($data) <= 0) {
return array("RESULT" => "ERROR", "TEXT" => GetMessage('SALE_DH_RUSSIANPOST_ERROR_CONNECT'));
}
if (strstr($data, DELIVERY_RUSSIANPOST_VALUE_CAPTHA_STRING)) {
$cResult = preg_match(DELIVERY_RUSSIANPOST_CAPTHA_REGEXP, $data, $matches);
$arCode = array();
$arCode["key"] = IntVal($matches[1]);
$data = QueryGetData(DELIVERY_RUSSIANPOST_SERVER, DELIVERY_RUSSIANPOST_SERVER_PORT, DELIVERY_RUSSIANPOST_SERVER_PAGE, implode("&", $arCode), $error_number = 0, $error_text = "", DELIVERY_RUSSIANPOST_SERVER_METHOD_CAPTHA);
}
if (strstr($data, DELIVERY_RUSSIANPOST_VALUE_CHECK_STRING)) {
$bResult = preg_match(DELIVERY_RUSSIANPOST_VALUE_CHECK_REGEXP_RUS, $data, $matches);
// both regexps must be checked! it's not only for russian and non-russian
if (!$bResult) {
$bResult = preg_match(DELIVERY_RUSSIANPOST_VALUE_CHECK_REGEXP, $data, $matches);
}
if ($bResult) {
$obCache->StartDataCache();
$result = $matches[1];
$result = str_replace(array(" ", ","), array("", "."), $result);
$result = doubleval($result);
$obCache->EndDataCache(array("RESULT" => $result));
// only these delivery types have insurance tax of 3% or 4% from price
if (in_array($arConfig["category"]["VALUE"], array(36, 16))) {
//.........这里部分代码省略.........
示例6: GetLangFileName
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
include GetLangFileName(dirname(__FILE__) . "/", "/assist.php");
$assist_Shop_IDP = CSalePaySystemAction::GetParamValue("SHOP_IDP");
$assist_LOGIN = CSalePaySystemAction::GetParamValue("SHOP_LOGIN");
$assist_PASSWORD = CSalePaySystemAction::GetParamValue("SHOP_PASSWORD");
$password = CSalePaySystemAction::GetParamValue("SHOP_SECRET_WORLD");
$ORDER_ID = IntVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ID"]);
set_time_limit(0);
$sHost = "payments.paysecure.ru";
$sUrl = "/orderstate/orderstate.cfm";
$dtm = AddToTimeStamp(array("MM" => -1), false);
$sVars = "Ordernumber=" . $ORDER_ID . "&Merchant_ID=" . $assist_Shop_IDP . "&login=" . $assist_LOGIN . "&password=" . $assist_PASSWORD . "&FORMAT=3&StartYear=" . date('Y', $dtm) . "&StartMonth=" . date('n', $dtm) . "&StartYDay=" . date('j', $dtm) . "";
$aDesc = array("In Process" => array(GetMessage("SASP_IP"), GetMessage("SASPD_IP")), "Delayed" => array(GetMessage("SASP_D"), GetMessage("SASPD_D")), "Approved" => array(GetMessage("SASP_A"), GetMessage("SASPD_A")), "PartialApproved" => array(GetMessage("SASP_PA"), GetMessage("SASPD_PA")), "PartialDelayed" => array(GetMessage("SASP_PD"), GetMessage("SASPD_PD")), "Canceled" => array(GetMessage("SASP_C"), GetMessage("SASPD_C")), "PartialCanceled" => array(GetMessage("SASP_PC"), GetMessage("SASPD_PC")), "Declined" => array(GetMessage("SASP_DEC"), GetMessage("SASPD_DEC")), "Timeout" => array(GetMessage("SASP_T"), GetMessage("SASPD_T")));
$sResult = QueryGetData($sHost, 80, $sUrl, $sVars, $errno, $errstr, "POST");
if ($sResult != "") {
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/xml.php";
$objXML = new CDataXML();
$objXML->LoadString($sResult);
$arResult = $objXML->GetArray();
if (count($arResult) > 0 && $arResult["result"]["@"]["firstcode"] == "0") {
$aRes = $arResult["result"]["#"]["order"][0]["#"];
if (IntVal($aRes["ordernumber"][0]["#"]) == $ORDER_ID) {
$arFields = array();
$check = ToUpper(md5(toUpper(md5($password) . md5($assist_Shop_IDP . $aRes["ordernumber"][0]["#"] . $aRes["orderamount"][0]["#"] . $aRes["ordercurrency"][0]["#"] . $aRes["orderstate"][0]["#"]))));
if ($aRes["checkvalue"][0]["#"] == $check) {
$arOrder = CSaleOrder::GetByID($ORDER_ID);
$arFields = array("PS_STATUS" => $aRes["orderstate"][0]["#"] == "Approved" ? "Y" : "N", "PS_STATUS_CODE" => substr($aRes["orderstate"][0]["#"], 0, 5), "PS_STATUS_DESCRIPTION" => $aDesc[$aRes["orderstate"][0]["#"]][0], "PS_STATUS_MESSAGE" => $aDesc[$aRes["orderstate"][0]["#"]][1], "PS_SUM" => DoubleVal($aRes["orderamount"][0]["#"]), "PS_CURRENCY" => $aRes["ordercurrency"][0]["#"], "PS_RESPONSE_DATE" => Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANG))));
if ($arOrder["PAYED"] != "Y" && CSalePaySystemAction::GetParamValue("AUTOPAY") == "Y" && $arFields["PS_STATUS"] == "Y" && Doubleval($arOrder["PRICE"]) == DoubleVal($arFields["PS_SUM"])) {
CSaleOrder::PayOrder($arOrder["ID"], "Y");
示例7: Calculate
function Calculate($profile, $arConfig, $arOrder, $STEP, $TEMP = false)
{
$arLocationFrom = CDeliveryDHLUSA::__GetLocation($arOrder['LOCATION_FROM']);
$arLocationTo = CDeliveryDHLUSA::__GetLocation($arOrder['LOCATION_TO']);
$location_from_zip = COption::GetOptionString('sale', 'location_zip');
if ($location_from_zip) {
$arLocationFrom['ZIP_LIST'] = array($location_from_zip);
}
$arOrder["WEIGHT"] = CSaleMeasure::Convert($arOrder["WEIGHT"], "G", "LBS");
if ($arOrder["WEIGHT"] <= 0) {
$arOrder["WEIGHT"] = 0.1;
}
// weight must not be null - let it be 1 gramm
$cache_id = "dhl_usa" . "|" . $arConfig["category"]['VALUE'] . "|" . $arOrder["LOCATION_FROM"] . "|" . $location_from_zip . "|" . $arOrder["LOCATION_TO"] . "|" . intval($arOrder['WEIGHT']);
$obCache = new CPHPCache();
if ($obCache->InitCache(DELIVERY_DHL_USA_CACHE_LIFETIME, $cache_id, "/")) {
// cache found
$vars = $obCache->GetVars();
$result = $vars["RESULT"];
$transit_time = $vars["TRANSIT"];
return array("RESULT" => "OK", "VALUE" => $result, "TRANSIT" => $transit_time);
}
// format HTTP query request data
$arQuery = array('userStatus' => 'NON_AUTHENTICATED_USER', 'customerType' => 'P', 'ratesType' => 'book', 'rateSuppressed' => 'N', 'CLIENT' => 'CLASS_NAME_P', 'CALLING_JSP' => '/jsp/ratesQuery.jsp', 'INTGRTDSURVEY' => 'false', 'totalPieces' => '1', 'packagesPerMonth' => '');
$arQuery['originCountryCode'] = 'US';
$arQuery['originZip'] = $arLocationFrom['ZIP_LIST'][0];
$arQuery['destinationCountry'] = $arLocationTo['COUNTRY_DHLUSA'];
$arQuery['destinationCountryName'] = $arLocationTo['COUNTRY_NAME'];
$arQuery['destinationCity'] = $arLocationTo['CITY_NAME'];
$arQuery['destinationZip'] = $arLocationTo['ZIP_LIST'][0];
$timestamp = strtotime(date('Y-m-d'));
$timestamp = strtotime('+1 day', $timestamp);
// holidays list - http://www.dhl-usa.com/USSvcs/USSvcsHDay.asp?nav=FindServInfo/USHol
$y = date('Y');
$arHolidaysList = array(strtotime($y . '-01-01'), strtotime($y . '-05-28'), strtotime($y . '-06-04'), strtotime($y . '-09-03'), strtotime($y . '-11-22'), strtotime($y . '-12-25'));
while (date('N', $timestamp) > 5 || in_array($timestamp, $arHolidaysList)) {
$timestamp += 86400;
}
$arQuery['shipDate'] = date('d F, Y', $timestamp);
$arQuery['pkgType'] = $arConfig['package_type']['VALUE'];
$arQuery['packagingType'] = $arConfig['package_type']['VALUE'];
$arQuery['packageWeight'] = $arOrder['WEIGHT'];
$arQuery['dmnLength'] = '';
$arQuery['dmnWidth'] = '';
$arQuery['dmnHeight'] = '';
$arQuery['dutiableFlag'] = 'N';
// !!!!!!
foreach ($arQuery as $key => $value) {
$arQuery[$key] = urlencode($key) . '=' . urlencode($value);
}
CDeliveryDHLUSA::__Write2Log(print_r($arQuery, true));
CDeliveryDHLUSA::__Write2Log(implode('&', $arQuery));
// get data from server
$data = QueryGetData(DELIVERY_DHL_USA_SERVER, DELIVERY_DHL_USA_SERVER_PORT, DELIVERY_DHL_USA_SERVER_PAGE, implode("&", $arQuery), $error_number = 0, $error_text = "", DELIVERY_DHL_USA_SERVER_METHOD);
CDeliveryDHLUSA::__Write2Log($data);
if (strlen($data) <= 0) {
return array("RESULT" => "ERROR", "TEXT" => GetMessage('SALE_DH_DHL_USA_ERROR_CONNECT'));
}
if (strstr($data, DELIVERY_DHL_USA_VALUE_CHECK_STRING)) {
// first check string found
if (preg_match(DELIVERY_DHL_USA_VALUE_CHECK_REGEXP, $data, $matches)) {
$obCache->StartDataCache();
// final price found
$result = $matches[1];
$result = preg_replace('/\\s/', '', $result);
$result = str_replace(',', '.', $result);
$result = doubleval($result);
$matches = array();
$transit_time = 0;
if (preg_match(DELIVERY_DHL_USA_TIME_CHECK_REGEXP, $data, $matches)) {
$transit_time = intval($matches[1]);
}
$obCache->EndDataCache(array("RESULT" => $result, "TRANSIT" => $transit_time));
return array("RESULT" => "OK", "VALUE" => $result, "TRANSIT" => $transit_time);
} else {
return array("RESULT" => "ERROR", "TEXT" => GetMessage('SALE_DH_DHL_USA_ERROR_RESPONSE'));
}
}
return array("RESULT" => "ERROR", "TEXT" => GetMessage('SALE_DH_DHL_USA_ERROR_RESPONSE'));
}
示例8: set_time_limit
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
set_time_limit(0);
$issuer_email = CSalePaySystemAction::GetParamValue("ShopEmail");
$pass = CSalePaySystemAction::GetParamValue("PASS");
$ORDER_ID = IntVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ID"]);
$sHost = "www.moneymail.ru";
$sUrl = "/";
$sVars = "check_bill:issuer_email=" . $issuer_email . "&invoice_number=&issuer_id=" . $ORDER_ID . "&hash=" . md5($pass . $issuer_email . $ORDER_ID);
$sResult = QueryGetData($sHost, 443, $sUrl, $sVars, $errno, $errstr, "GET", "ssl://");
if ($sResult != "") {
$aResult = explode("\n", $sResult);
if ($aResult[0] == "OK") {
$bWasSuccess = false;
foreach ($aResult as $val) {
if ($val == "OK") {
//new result within results set
//only success result is nedded
if ($bWasSuccess == true) {
break;
}
$aFields = array();
}
$aVal = explode("=", $val);
if (count($aVal) == 2) {
$aFields[$aVal[0]] = $aVal[1];
if ($aVal[0] == "status" && $aFields["status"] == "PAID") {
$bWasSuccess = true;
示例9: __EMSQuery
function __EMSQuery($method, $arParams = array())
{
$arQuery = array('method=' . $method);
foreach ($arParams as $key => $value) {
$arQuery[] = $key . '=' . urlencode($value);
}
$data = QueryGetData('www.emspost.ru', 80, '/api/rest', implode("&", $arQuery), $error_number = 0, $error_text = "", 'GET');
$data = $GLOBALS['APPLICATION']->ConvertCharset($data, 'utf-8', LANG_CHARSET);
if (($pos = strpos($data, "\n")) !== false) {
$data = trim(substr($data, 0, $pos));
}
CDeliveryEMS::__Write2Log($error_number . ": " . $error_text);
CDeliveryEMS::__Write2Log($data);
$arResult = CDeliveryEMS::JsObjectToPhp($data);
return $arResult;
}
示例10: saleLocationLoadFile
function saleLocationLoadFile($arParams)
{
$arReturn = array('STEP' => false, 'ERROR' => '', 'MESSAGE' => '');
define('DLSERVER', $arParams['DLSERVER']);
define('DLPORT', $arParams['DLPORT']);
define('DLPATH', $arParams['DLPATH']);
define('DLMETHOD', $arParams['DLMETHOD']);
define('DLZIPFILE', $arParams['DLZIPFILE']);
if (isset($arParams['TMP_PATH'])) {
$sTmpFilePath = $arParams['TMP_PATH'];
} else {
$sTmpFilePath = CTempFile::GetDirectoryName(12, 'sale');
}
set_time_limit(600);
$STEP = intval($arParams['STEP']);
$CSVFILE = $arParams["CSVFILE"];
$LOADZIP = $arParams["LOADZIP"];
if (strlen($CSVFILE) > 0 && !in_array($CSVFILE, array('loc_ussr.csv', 'loc_ua.csv', 'loc_kz.csv', 'loc_usa.csv', 'loc_cntr.csv', 'locations.csv'))) {
$arReturn['ERROR'] = GetMessage('SL_IMPORT_ERROR_FILES');
} else {
if ($STEP == 1 && (strlen($CSVFILE) <= 0 || $CSVFILE == 'locations.csv')) {
if ($LOADZIP == 'Y') {
$STEP = 2;
} else {
$STEP = 3;
}
}
switch ($STEP) {
case 0:
$arReturn['MESSAGE'] = GetMessage('SL_LOADER_LOADING');
$arReturn['STEP'] = 1;
break;
case 1:
$file_url = DLPATH . $CSVFILE;
$data = QueryGetData(DLSERVER, DLPORT, $file_url, '', $error_number = 0, $error_text = "", DLMETHOD);
if (strlen($data) > 0) {
CheckDirPath($sTmpFilePath);
$fp = fopen($sTmpFilePath . $CSVFILE, 'w');
fwrite($fp, $GLOBALS['APPLICATION']->ConvertCharset($data, 'windows-1251', LANG_CHARSET));
fclose($fp);
$arReturn['MESSAGE'] = GetMessage('SL_LOADER_FILE_LOADED') . ' ' . $CSVFILE;
$arReturn['STEP'] = $LOADZIP == "Y" ? 2 : 3;
} else {
$arReturn['ERROR'] = GetMessage('SL_LOADER_FILE_ERROR') . ' ' . $CSVFILE;
$arReturn['RUN_ERROR'] = true;
}
break;
case 2:
$file_url = DLPATH . DLZIPFILE;
$data = QueryGetData(DLSERVER, DLPORT, $file_url, '', $error_number = 0, $error_text = "", DLMETHOD);
if (strlen($data) > 0) {
CheckDirPath($sTmpFilePath);
$fp = fopen($sTmpFilePath . DLZIPFILE, 'w');
fwrite($fp, $GLOBALS['APPLICATION']->ConvertCharset($data, 'windows-1251', LANG_CHARSET));
fclose($fp);
$arReturn['MESSAGE'] = GetMessage('SL_LOADER_FILE_LOADED') . ' ' . DLZIPFILE;
$arReturn['STEP'] = 3;
} else {
$arReturn['ERROR'] = GetMessage('SL_LOADER_FILE_ERROR') . ' ' . DLZIPFILE;
$arReturn['RUN_ERROR'] = true;
}
break;
case 3:
$arReturn['COMPLETE'] = true;
break;
}
}
return $arReturn;
}
示例11: str_replace
$sHost = "merchant.money.mail.ru";
$sUrl = "/api/invoice/make";
$sVars = "key=" . $arParams['access_key'] . "&buyer_email=" . $arParams['buyer_email'] . "&sum=" . str_replace(",", ".", $arParams['shouldPay']) . "¤cy=" . $arParams['currency'] . "&description=" . $arParams['description'] . "&buyer_ip=" . $arParams['buyer_ip'] . "&issuer_id=" . $arParams['issuer_id'];
$invoice_number = QueryGetData($sHost, 443, $sUrl, $sVars, $errno, $errstr, "GET", "ssl://");
if (is_numeric($invoice_number)) {
CSaleOrder::Update($ORDER_ID, array('PAY_VOUCHER_NUM' => $invoice_number, 'PAY_VOUCHER_DATE' => $dateInsert));
}
}
if (is_numeric($invoice_number)) {
$message .= GetMessage('MM_INVOICE_NUM', array('#INVOICE_NUM#' => $invoice_number));
$sHost = "merchant.money.mail.ru";
$sUrl = "/api/invoice/item/";
$access_key = rawurlencode(strlen(CSalePaySystemAction::GetParamValue("KEY")) > 0 ? CSalePaySystemAction::GetParamValue("KEY") : $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["KEY"]);
$sVars = "key=" . $access_key . "&invoice_number=" . $invoice_number;
sleep(1);
$CheckStatus = QueryGetData($sHost, 443, $sUrl, $sVars, $errno, $errstr, "GET", "ssl://");
if ($CheckStatus) {
parse_str(str_replace(array("\r\n", "\n", "\r"), "&", 'success=' . $CheckStatus), $Data);
$default_url = 'https://money.mail.ru';
if ($Data['success'] == 'OK') {
switch ($Data['status']) {
case 'NEW':
$message .= GetMessage('MM_PAY_NEW_INVOICE', array('#URL#' => $default_url));
break;
case 'DELIVERED':
$message .= GetMessage('MM_PAY_DELIVERED_INVOICE', array('#URL#' => $Data['url_pay']));
break;
case 'PAID':
$message .= GetMessage('MM_ALLREADY_PAID');
break;
case 'REJECTED':
示例12: CheckKernel
function CheckKernel($arParams)
{
$time_start = time();
global $DB;
$arCompare = Array(
"install/components/bitrix/" => "/bitrix/components/bitrix/",
"install/js/" => "/bitrix/js/",
"install/activities/" => "/bitrix/activities/",
);
if(!$_SESSION["BX_CHECKLIST"][$arParams["TEST_ID"]])
$_SESSION["BX_CHECKLIST"][$arParams["TEST_ID"]] = Array();
$NS = &$_SESSION["BX_CHECKLIST"][$arParams["TEST_ID"]];
if ($arParams["STEP"] == false)
{
$NS = Array();
$rsInstalledModules = CModule::GetList();
while ($ar = $rsInstalledModules->Fetch())
{
if (!strpos($ar["ID"],"."))
$NS["MLIST"][] = $ar["ID"];
}
$NS["MNUM"] = 0;
$NS["FILE_LIST"] = Array();
$NS["FILES_COUNT"] = 0;
$NS["MODFILES_COUNT"] = 0;
}
$arError = false;
$module_id = $NS["MLIST"][$NS["MNUM"]];
$module_folder = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$module_id."/";
$dbtype = strtolower($DB->type);
if ($module_id == "main")
$ver = SM_VERSION;
else
{
@include($module_folder."install/version.php");
$ver = $arModuleVersion["VERSION"];
}
if (!$ver)
{
$state = Array(
"STATUS" => false,
"MESSAGE" => GetMessage("CL_MODULE_VERSION_ERROR",Array("#module_id#"=>$module_id))."\n"
);
$arError = true;
}
else
{
if(count($NS["FILE_LIST"]) == 0)
{
$sHost = COption::GetOptionString("main","update_site","www.bitrixsoft.com");
$sUrl = "/bitrix/updates/checksum.php";
$sVars = "check_sum=Y&module_id=".$module_id."&ver=".$ver."&dbtype=".$dbtype."&mode=2";
$data = QueryGetData($sHost, 80, $sUrl, $sVars, $errno, $errstr);
$NS["FILE_LIST"] = $result = unserialize(gzinflate($data));
$NS["MODULE_FILES_COUNT"] = count($NS["FILE_LIST"]);
}
else
{
$result = $NS["FILE_LIST"];
}
$arMessage = "";
$arFilesCount = 0;
$arModifiedFilesCount = 0;
$timeout = COption::GetOptionString("main","update_load_timeout","30");
if (is_array($result) && !$result["error"])
{
foreach($result as $file=>$checksum)
{
$arFile = $module_folder.$file;
unset($NS["FILE_LIST"][$file]);
if (!file_exists($arFile))
continue;
$arFilesCount++;
if (md5_file($arFile)!=$checksum)
{
$arMessage.= str_replace(Array("//","\\\\"),Array("/","\\"),$arFile)."\n";
$arModifiedFilesCount++;
}
$arTmpCompare = $arCompare;
foreach ($arTmpCompare as $key=>$value)
if (strpos($file,$key) === 0)
{
$arFile = str_replace($key,$_SERVER["DOCUMENT_ROOT"].$value,$file);
if (file_exists($arFile) && md5_file($arFile)!=$checksum)
{
$arModifiedFilesCount++;
$arMessage.= str_replace(Array("//","\\\\"),Array("/","\\"),$arFile)."\n";
}
$arFilesCount++;
}
if ((time()-$time_start)>=$timeout)
break;
}
if (strlen($arMessage)> 0)
{
$state = Array(
"MESSAGE" => $arMessage,
"STATUS" => false
//.........这里部分代码省略.........
示例13: QueryGetData
$data = QueryGetData(DLSERVER, DLPORT, $file_url, '', $error_number = 0, $error_text = "", DLMETHOD);
if (strlen($data) > 0) {
CheckDirPath($_SERVER['DOCUMENT_ROOT'] . UPPATH);
$fp = fopen($_SERVER['DOCUMENT_ROOT'] . UPPATH . $CSVFILE, 'w');
fwrite($fp, $APPLICATION->ConvertCharset($data, 'windows-1251', LANG_CHARSET));
fclose($fp);
echo GetMessage('WSL_LOADER_FILE_LOADED') . ' ' . $CSVFILE;
echo '<script>Run(' . ($LOADZIP == "Y" ? 2 : 3) . ')</script>';
} else {
echo GetMessage('WSL_LOADER_FILE_ERROR') . ' ' . $CSVFILE;
echo '<script>RunError()</script>';
}
break;
case 2:
$file_url = DLPATH . DLZIPFILE;
$data = QueryGetData(DLSERVER, DLPORT, $file_url, '', $error_number = 0, $error_text = "", DLMETHOD);
if (strlen($data) > 0) {
CheckDirPath($_SERVER['DOCUMENT_ROOT'] . UPPATH);
$fp = fopen($_SERVER['DOCUMENT_ROOT'] . UPPATH . DLZIPFILE, 'w');
fwrite($fp, $APPLICATION->ConvertCharset($data, 'windows-1251', LANG_CHARSET));
fclose($fp);
echo GetMessage('WSL_LOADER_FILE_LOADED') . ' ' . DLZIPFILE;
echo '<script>Run(3)</script>';
} else {
echo GetMessage('WSL_LOADER_FILE_ERROR') . ' ' . DLZIPFILE;
echo '<script>RunError()</script>';
}
break;
case 3:
echo GetMessage('WSL_LOADER_ALL_LOADED');
echo '<script>EnableButton();</script>';
示例14: Query
private static function Query($method, $arQuery)
{
global $APPLICATION;
$MODULE_ID = "epages.pickpoint";
$bpp_test_mode = COption::GetOptionString($MODULE_ID, "pp_test_mode", "");
if ($bpp_test_mode) {
$apiUrl = '/apitest/';
} else {
$apiUrl = '/api/';
}
if (!(defined("BX_UTF") && BX_UTF == true)) {
$arQuery = $APPLICATION->ConvertCharsetArray($arQuery, "windows-1251", "utf-8");
}
$response = QueryGetData('e-solution.pickpoint.ru', '80', $apiUrl . $method, json_encode($arQuery), $error_number = 0, $error_text = '', 'POST', "", "application/json");
$response = json_decode($response);
self::checkErrors($response);
return $response;
}
示例15: LoadCurrencyRates
public static function LoadCurrencyRates($bank = array())
{
$arResult = array();
$DATA = array("CBRF" => array("URL" => "www.cbr.ru", "LINK" => "/scripts/XML_daily.asp", "PORT" => "80", "ITEMS" => array("ValCurs", "#", "Valute"), "CURRENCY" => array("#", "CharCode", 0, "#"), "RATE" => array("#", "Nominal", 0, "#"), "VALUE" => array("#", "Value", 0, "#")), "NBU" => array("URL" => "bank-ua.com", "LINK" => "/export/currrate.xml", "PORT" => "80", "ITEMS" => array("chapter", "#", "item"), "CURRENCY" => array("#", "char3", 0, "#"), "RATE" => array("#", "size", 0, "#"), "VALUE" => array("#", "rate", 0, "#")), "NBK" => array("URL" => "www.nationalbank.kz", "LINK" => "/rss/rates_all.xml", "PORT" => "80", "ITEMS" => array("rss", "#", "channel", 0, "#", "item"), "CURRENCY" => array("#", "title", 0, "#"), "RATE" => array("#", "quant", 0, "#"), "VALUE" => array("#", "description", 0, "#")), "NBB" => array("URL" => "www.nbrb.by", "LINK" => "/Services/XmlExRates.aspx", "PORT" => "80", "ITEMS" => array("DailyExRates", "#", "Currency"), "CURRENCY" => array("#", "CharCode", 0, "#"), "RATE" => array("#", "Scale", 0, "#"), "VALUE" => array("#", "Rate", 0, "#")));
if (sizeof($bank) <= 0) {
$bank = array_keys($DATA);
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/xml.php";
foreach ($bank as $bnk) {
$strQueryText = QueryGetData($DATA[$bnk]["URL"], $DATA[$bnk]["PORT"], $DATA[$bnk]["LINK"], "", $error_number, $error_text);
if (strlen($strQueryText) > 0) {
$objXML = new CDataXML();
$objXML->LoadString($strQueryText);
$arData = $objXML->GetArray();
for ($i = 0; $i < sizeof($DATA[$bnk]["ITEMS"]); $i++) {
$arData = $arData[$DATA[$bnk]["ITEMS"][$i]];
}
if (is_array($arData) && count($arData) > 0) {
for ($j1 = 0; $j1 < count($arData); $j1++) {
for ($i = 0; $i < sizeof($DATA[$bnk]["VALUE"]); $i++) {
if ($i == 0) {
$q1 = $arData[$j1][$DATA[$bnk]["VALUE"][$i]];
} elseif ($i > 0) {
$q1 = $q1[$DATA[$bnk]["VALUE"][$i]];
}
}
$arCurrValue = str_replace(",", ".", $q1);
for ($i = 0; $i < sizeof($DATA[$bnk]["CURRENCY"]); $i++) {
if ($i == 0) {
$currency1 = $arData[$j1][$DATA[$bnk]["CURRENCY"][$i]];
} elseif ($i > 0) {
$currency1 = $currency1[$DATA[$bnk]["CURRENCY"][$i]];
}
}
for ($i = 0; $i < sizeof($DATA[$bnk]["RATE"]); $i++) {
if ($i == 0) {
$rate = $arData[$j1][$DATA[$bnk]["RATE"][$i]];
} elseif ($i > 0) {
$rate = $rate[$DATA[$bnk]["RATE"][$i]];
}
}
$curr = DoubleVal($arCurrValue);
if (sizeof($currency) > 0) {
if (in_array($currency1, $currency)) {
$arResult[$bnk][] = array("RATE" => round($curr, 2), "RATE_CNT" => $rate, "CURRENCY" => $currency1);
}
} else {
$arResult[$bnk][] = array("RATE" => round($curr, 2), "RATE_CNT" => $rate, "CURRENCY" => $currency1);
}
}
}
}
}
$arResultNew = array();
foreach ($arResult as $rate => $value) {
foreach ($value as $currency) {
$arResultNew[$rate][$currency["CURRENCY"]] = $currency;
}
}
$arResult = $arResultNew;
$arResult["CBRF"]["RUB"] = array("CURRENCY" => "RUB", "RATE" => 1, "RATE_CNT" => 1);
unset($arResultNew);
return $arResult;
}