当前位置: 首页>>代码示例>>PHP>>正文


PHP CDataXML::LoadString方法代码示例

本文整理汇总了PHP中CDataXML::LoadString方法的典型用法代码示例。如果您正苦于以下问题:PHP CDataXML::LoadString方法的具体用法?PHP CDataXML::LoadString怎么用?PHP CDataXML::LoadString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDataXML的用法示例。


在下文中一共展示了CDataXML::LoadString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getData

 public function getData()
 {
     $xml_str = file_get_contents($this->file);
     $xml = new \CDataXML();
     $xml->LoadString($xml_str);
     $arXml = $xml->GetArray();
     unset($xml_str);
     return $this->toTmp($arXml);
 }
开发者ID:HannibalLecktor,项目名称:alfa74,代码行数:9,代码来源:parsexml.php

示例2: 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;
 }
开发者ID:slavaskazochnik,项目名称:vnukovo-transagency,代码行数:56,代码来源:vko.php

示例3: action

 /**
  * Returns action response XML
  *
  * @param string $action
  * @return CDataXML
  * @throws CBitrixCloudException
  */
 protected function action($action)
 {
     /* @var CMain $APPLICATION */
     global $APPLICATION;
     $url = $this->getActionURL(array("action" => $action, "debug" => $this->debug ? "y" : "n"));
     $this->server = new CHTTP();
     if ($this->timeout > 0) {
         $this->server->http_timeout = $this->timeout;
     }
     $strXML = $this->server->Get($url);
     if ($strXML === false) {
         $e = $APPLICATION->GetException();
         if (is_object($e)) {
             throw new CBitrixCloudException($e->GetString(), "");
         } else {
             throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => "-1")), "");
         }
     }
     if ($this->server->status != 200) {
         throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => (string) $this->server->status)), "");
     }
     $obXML = new CDataXML();
     if (!$obXML->LoadString($strXML)) {
         throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_XML_PARSE", array("#CODE#" => "1")), "");
     }
     $node = $obXML->SelectNodes("/error/code");
     if (is_object($node)) {
         $error_code = $node->textContent();
         $message_id = "BCL_CDN_WS_" . $error_code;
         /*
         GetMessage("BCL_CDN_WS_LICENSE_EXPIRE");
         GetMessage("BCL_CDN_WS_LICENSE_NOT_FOUND");
         GetMessage("BCL_CDN_WS_QUOTA_EXCEEDED");
         GetMessage("BCL_CDN_WS_CMS_LICENSE_NOT_FOUND");
         GetMessage("BCL_CDN_WS_DOMAIN_NOT_REACHABLE");
         GetMessage("BCL_CDN_WS_LICENSE_DEMO");
         GetMessage("BCL_CDN_WS_LICENSE_NOT_ACTIVE");
         GetMessage("BCL_CDN_WS_NOT_POWERED_BY_BITRIX_CMS");
         GetMessage("BCL_CDN_WS_WRONG_DOMAIN_SPECIFIED");
         */
         $debug_content = "";
         $node = $obXML->SelectNodes("/error/debug");
         if (is_object($node)) {
             $debug_content = $node->textContent();
         }
         if (HasMessage($message_id)) {
             throw new CBitrixCloudException(GetMessage($message_id), $error_code, $debug_content);
         } else {
             throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => $error_code)), $error_code, $debug_content);
         }
     }
     return $obXML;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:60,代码来源:webservice.php

示例4: Request

 function Request($server, $page, $port, $params, $uri = false)
 {
     if ($uri && strlen($uri) > 0) {
         $strURI = $uri;
     } else {
         $strURI = "http://" . $server . (strlen($port) > 0 && intval($port) > 0 ? ":" . intval($port) : "") . (strlen($page) ? $page : "/") . (strlen($params) > 0 ? "?" . $params : "");
     }
     $http = new \Bitrix\Main\Web\HttpClient(array("version" => "1.0", "socketTimeout" => 30, "streamTimeout" => 30, "redirect" => true, "redirectMax" => 5));
     $strData = $http->get($strURI);
     $errors = $http->getError();
     $arRSSResult = array();
     if (!$strData && !empty($errors)) {
         $strError = "";
         foreach ($errors as $errorCode => $errMes) {
             $strError .= $errorCode . ": " . $errMes;
         }
         \CEventLog::Add(array("SEVERITY" => "ERROR", "AUDIT_TYPE_ID" => "XDIMPORT_HTTP", "MODULE_ID" => "xdimport", "ITEM_ID" => "RSS_REQUEST", "DESCRIPTION" => $strError));
     }
     if ($strData) {
         $rss_charset = "windows-1251";
         if (preg_match("/<" . "\\?XML[^>]{1,}encoding=[\"']([^>\"']{1,})[\"'][^>]{0,}\\?" . ">/i", $strData, $matches)) {
             $rss_charset = Trim($matches[1]);
         }
         $strData = preg_replace("/<" . "\\?XML.*?\\?" . ">/i", "", $strData);
         $strData = $GLOBALS["APPLICATION"]->ConvertCharset($strData, $rss_charset, SITE_CHARSET);
     }
     if (strlen($strData) > 0) {
         require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/xml.php";
         $objXML = new CDataXML();
         $res = $objXML->LoadString($strData);
         if ($res !== false) {
             $ar = $objXML->GetArray();
             if (is_array($ar) && isset($ar["rss"]) && is_array($ar["rss"]) && isset($ar["rss"]["#"]) && is_array($ar["rss"]["#"]) && isset($ar["rss"]["#"]["channel"]) && is_array($ar["rss"]["#"]["channel"]) && isset($ar["rss"]["#"]["channel"][0]) && is_array($ar["rss"]["#"]["channel"][0]) && isset($ar["rss"]["#"]["channel"][0]["#"])) {
                 $arRSSResult = $ar["rss"]["#"]["channel"][0]["#"];
             } else {
                 $arRSSResult = array();
             }
             $arRSSResult["rss_charset"] = strtolower(SITE_CHARSET);
         }
     }
     if (is_array($arRSSResult) && !empty($arRSSResult)) {
         $arRSSResult = CXDILFSchemeRSS::FormatArray($arRSSResult);
         if (!empty($arRSSResult) && array_key_exists("item", $arRSSResult) && is_array($arRSSResult["item"]) && !empty($arRSSResult["item"])) {
             $arRSSResult["item"] = array_reverse($arRSSResult["item"]);
         }
     }
     return $arRSSResult;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:48,代码来源:lf_scheme_rss.php

示例5: AddFlightsToResult

 function AddFlightsToResult($html, $result, $terminal)
 {
     $res = '<table>' . $html . '</table>';
     $res = str_replace("&nbsp;", " ", $res);
     $res = str_replace("<br>", " ", $res);
     $res = preg_replace("/<!--.*-->/Uis", "", $res);
     $res = preg_replace("/<colgroup>.*<\\/colgroup>/Uis", "", $res);
     $res = preg_replace("/<param[^>]*>/Uis", "", $res);
     $res = preg_replace("/<a[^>]*>[^<]+<\\/a>/Uis", "", $res);
     //trace($res);
     $xml = new CDataXML();
     if ($xml->LoadString($res)) {
         $node = $xml->SelectNodes("/table");
         $rows = $node->elementsByName("tr");
         $i = 0;
         foreach ($rows as $row) {
             //trace($row->getAttribute("class"));
             if (!strstr($row->getAttribute("class"), "onlineDetailTr")) {
                 $cells = $row->elementsByName("td");
                 if (count($cells) && preg_match("/([A-Za-zА-Яа-я0-9]{2})\\s*([0-9]+)\\s*/", $cells[0]->content)) {
                     // Определяем код авиакомпании и номер рейса
                     preg_match_all("/([A-Za-zА-Яа-я0-9]{2})\\s*([0-9]+)\\s*/", $cells[0]->content, $flightNumber, PREG_PATTERN_ORDER);
                     $result["FLIGHTS"][$i] = array("FLIGHT" => array("AK_CODE" => $flightNumber[1][0], "NUMBER" => $flightNumber[2][0]), "AK_NAME" => htmlspecialcharsEx($cells[5]->content), "DEPARTURE" => htmlspecialcharsEx($cells[1]->content), "ARRIVAL" => htmlspecialcharsEx($cells[1]->content), "STATUS" => CAirportBoard::GetStatusInfo($cells[4]->content), "TIME" => array("PLANNED" => CAirportBoard::GetDateTimeArray($cells[2]->content), "ESTIMATED" => "", "ACTUAL" => CAirportBoard::GetDateTimeArray($cells[3]->content)), "TERMINAL" => $terminal);
                     // Формируем список уникальных терминалов и пунктов вылета и прилета для фильтра
                     if (!in_array($flightNumber[1][0], $result["AK_CODES"])) {
                         $result["AK_CODES"][] = $flightNumber[1][0];
                     }
                     if (!in_array($result["FLIGHTS"][$i]["AK_NAME"], $result["AK_NAMES"]) && strlen($result["FLIGHTS"][$i]["AK_NAME"])) {
                         $result["AK_NAMES"][] = $result["FLIGHTS"][$i]["AK_NAME"];
                     }
                     if (!in_array($result["FLIGHTS"][$i]["DEPARTURE"], $result["DEPARTURES"])) {
                         $result["DEPARTURES"][] = $result["FLIGHTS"][$i]["DEPARTURE"];
                     }
                     if (!in_array($result["FLIGHTS"][$i]["ARRIVAL"], $result["ARRIVALS"])) {
                         $result["ARRIVALS"][] = $result["FLIGHTS"][$i]["ARRIVAL"];
                     }
                     if (!in_array($result["FLIGHTS"][$i]["TERMINAL"], $result["TERMINALS"])) {
                         $result["TERMINALS"][] = $result["FLIGHTS"][$i]["TERMINAL"];
                     }
                     $i++;
                 }
             }
         }
     }
     unset($html, $xml, $res);
     return $result;
 }
开发者ID:slavaskazochnik,项目名称:vnukovo-transagency,代码行数:47,代码来源:led.php

示例6: GetNewsEx

	function GetNewsEx($SITE, $PORT, $PATH, $QUERY_STR, $bOutChannel = False)
	{
		global $APPLICATION;

		$cacheKey = md5($SITE.$PORT.$PATH.$QUERY_STR);

		$bValid = False;
		$bUpdate = False;
		if ($db_res_arr = CIBlockRSS::GetCache($cacheKey))
		{
			$bUpdate = True;
			if (strlen($db_res_arr["CACHE"])>0)
			{
				if ($db_res_arr["VALID"]=="Y")
				{
					$bValid = True;
					$text = $db_res_arr["CACHE"];
				}
			}
		}

		if (!$bValid)
		{
			$FP = fsockopen($SITE, $PORT, $errno, $errstr, 120);

			if ($FP)
			{
				$strVars = $QUERY_STR;
				$strRequest = "GET ".$PATH.(strlen($strVars) > 0? "?".$strVars: "")." HTTP/1.0\r\n";
				$strRequest.= "User-Agent: BitrixSMRSS\r\n";
				$strRequest.= "Accept: */*\r\n";
				$strRequest.= "Host: $SITE\r\n";
				$strRequest.= "Accept-Language: en\r\n";
				$strRequest.= "\r\n";
				fputs($FP, $strRequest);

				$headers = "";
				while(!feof($FP))
				{
					$line = fgets($FP, 4096);
					if($line == "\r\n")
						break;
					$headers .= $line;
				}

				$text = "";
				while(!feof($FP))
					$text .= fread($FP, 4096);

				$rss_charset = "windows-1251";
				if (preg_match("/<"."\?XML[^>]{1,}encoding=[\"']([^>\"']{1,})[\"'][^>]{0,}\?".">/i", $text, $matches))
				{
					$rss_charset = Trim($matches[1]);
				}
				elseif($headers)
				{
					if(preg_match("#^Content-Type:.*?charset=([a-zA-Z0-9-]+)#m", $headers, $match))
						$rss_charset = $match[1];
				}

				$text = preg_replace("/<!DOCTYPE.*?>/i", "", $text);
				$text = preg_replace("/<"."\\?XML.*?\\?".">/i", "", $text);
				$text = $APPLICATION->ConvertCharset($text, $rss_charset, SITE_CHARSET);

				fclose($FP);
			}
			else
			{
				$text = "";
			}
		}

		if (strlen($text) > 0)
		{
			require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/xml.php");
			$objXML = new CDataXML();
			$res = $objXML->LoadString($text);
			if($res !== false)
			{
				$ar = $objXML->GetArray();
				//$ar = xmlize_rss($text1);

				if (!$bOutChannel)
				{
					$arRes = $ar["rss"]["#"]["channel"][0]["#"];
				}
				else
				{
					$arRes = $ar["rss"]["#"];
				}

				$arRes["rss_charset"] = strtolower(SITE_CHARSET);

				if (!$bValid)
				{
					$ttl = (strlen($arRes["ttl"][0]["#"]) > 0)? IntVal($arRes["ttl"][0]["#"]): 60;
					CIBlockRSS::UpdateCache($cacheKey, $text, array("minutes" => $ttl), $bUpdate);
				}
			}
			return $arRes;
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:101,代码来源:iblockrss.php

示例7: ParseOrderData

 private function ParseOrderData($orderData, &$modificationLabel, &$arErrors)
 {
     if (empty($orderData)) {
         $arErrors[] = array("PD1", GetMessage("CRM_EXT_SALE_IMPORT_EMPTY_ANSW"));
         return null;
     }
     if (substr(ltrim($orderData), 0, strlen('<?xml')) != '<?xml') {
         $orderDataTmp = @gzuncompress($orderData);
         if (substr(ltrim($orderDataTmp), 0, strlen('<?xml')) != '<?xml') {
             if (strpos($orderDataTmp, "You haven't rights for exchange") !== false) {
                 $arErrors[] = array("PD2", GetMessage("CRM_EXT_SALE_IMPORT_UNKNOWN_ANSW_PERMS"));
             } elseif (strpos($orderDataTmp, "failure") !== false) {
                 $arErrors[] = array("PD2", GetMessage("CRM_EXT_SALE_IMPORT_UNKNOWN_ANSW_F"));
                 $arErrors[] = array("PD2", preg_replace("/\\s*failure\n/", "", $orderDataTmp));
             } elseif (strpos($orderData, "Authorization") !== false || strpos($orderData, "Access denied") !== false) {
                 $arErrors[] = array("PD2", GetMessage("CRM_EXT_SALE_IMPORT_UNKNOWN_ANSW_PERMS1"));
             } else {
                 $arErrors[] = array("PD2", GetMessage("CRM_EXT_SALE_IMPORT_UNKNOWN_ANSW") . substr($orderData, 0, 100));
             }
             return null;
         }
         $orderData = $orderDataTmp;
         unset($orderDataTmp);
     }
     $charset = "";
     if (preg_match("/^<" . "\\?xml[^>]+?encoding=[\"']([^>\"']+)[\"'][^>]*\\?" . ">/i", $orderData, $matches)) {
         $charset = trim($matches[1]);
     }
     if (!empty($charset) && strtoupper($charset) != strtoupper(SITE_CHARSET)) {
         $orderData = CharsetConverter::ConvertCharset($orderData, $charset, SITE_CHARSET);
     }
     $objXML = new CDataXML();
     if ($objXML->LoadString($orderData)) {
         $arOrderData = $objXML->GetArray();
     } else {
         $arErrors[] = array("XL1", GetMessage("CRM_EXT_SALE_IMPORT_ERROR_XML"));
         return null;
     }
     $arSettings = array();
     foreach ($arOrderData["CommerceInformation"]["@"] as $key => $value) {
         $arSettings[$key] = array();
         $ar1 = explode(";", $value);
         foreach ($ar1 as $v1) {
             $ar2 = explode("=", $v1);
             if (count($ar2) == 2) {
                 $arSettings[$key][trim($ar2[0])] = $ar2[1];
             }
         }
         if (count($arSettings[$key]) <= 0) {
             $arSettings[$key] = $value;
         }
     }
     if (!isset($arSettings["SumFormat"]["CRD"])) {
         $arSettings["SumFormat"]["CRD"] = '.';
     }
     if (!isset($arSettings["QuantityFormat"]["CRD"])) {
         $arSettings["QuantityFormat"]["CRD"] = '.';
     }
     if (!isset($arSettings["DateFormat"]["DF"])) {
         $arSettings["DateFormat"]["DF"] = 'yyyy-MM-dd';
     }
     $arSettings["DateFormat"]["DF"] = strtoupper($arSettings["DateFormat"]["DF"]);
     if (!isset($arSettings["TimeFormat"]["DF"])) {
         $arSettings["TimeFormat"]["DF"] = 'HH:MM:SS';
     }
     $arSettings["TimeFormat"]["DF"] = str_replace("MM", "MI", $arSettings["TimeFormat"]["DF"]);
     $arOrders = array();
     if (is_array($arOrderData["CommerceInformation"]["#"]) && is_array($arOrderData["CommerceInformation"]["#"]["Document"])) {
         foreach ($arOrderData["CommerceInformation"]["#"]["Document"] as $arDocument) {
             if ($arDocument["#"]["BusinessTransaction"][0]["#"] == "ItemOrder") {
                 $v = $this->ParseOrderDataOrder($arDocument, $arSettings);
                 if (is_array($v)) {
                     $arOrders[] = $v;
                     if (isset($v["DATE_UPDATE"])) {
                         $modificationLabelTmp = MakeTimeStamp($v["DATE_UPDATE"]);
                         if ($modificationLabelTmp > $modificationLabel) {
                             $modificationLabel = $modificationLabelTmp;
                         }
                     }
                 }
             }
         }
     }
     return $arOrders;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:85,代码来源:crm_external_sale_import.php

示例8: 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;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:security_service_s3.php

示例9: HttpClient

     case 'RUR':
         $url = 'http://www.cbr.ru/scripts/XML_daily.asp?date_req=' . $DB->FormatDate($date, CLang::GetDateFormat('SHORT', LANGUAGE_ID), 'D.M.Y');
         break;
 }
 $http = new HttpClient();
 $data = $http->get($url);
 $charset = 'windows-1251';
 $matches = array();
 if (preg_match("/<" . "\\?XML[^>]{1,}encoding=[\"']([^>\"']{1,})[\"'][^>]{0,}\\?" . ">/i", $data, $matches)) {
     $charset = trim($matches[1]);
 }
 $data = preg_replace("#<!DOCTYPE[^>]+?>#i", '', $data);
 $data = preg_replace("#<" . "\\?XML[^>]+?\\?" . ">#i", '', $data);
 $data = $APPLICATION->ConvertCharset($data, $charset, SITE_CHARSET);
 $objXML = new CDataXML();
 $res = $objXML->LoadString($data);
 if ($res !== false) {
     $data = $objXML->GetArray();
 } else {
     $data = false;
 }
 switch ($baseCurrency) {
     case 'UAH':
         if (is_array($data) && count($data["exchange"]["#"]['currency']) > 0) {
             $currencyList = $data['exchange']['#']['currency'];
             foreach ($currencyList as &$currencyRate) {
                 if ($currencyRate['#']['cc'][0]['#'] == $currency) {
                     $result['STATUS'] = 'OK';
                     $result['RATE_CNT'] = 1;
                     $result['RATE'] = (double) str_replace(",", ".", $currencyRate['#']['rate'][0]['#']);
                     break;
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:get_rate.php

示例10: UpdateListItems


//.........这里部分代码省略.........

				$arData['Location'] = trim($arData['Location']);

				if (isset($arData['EventDate']))
				{
					$arData['EventDate'] = $this->__makeTS($arData['EventDate']);
					$arData['EndDate'] = $this->__makeTS($arData['EndDate']) + ($arData['fAllDayEvent'] ? -86340 : 0);
					$TZBias = intval(date('Z', $arData['EventDate']));
				}

				$arData['EventType'] = intval($arData['EventType']);

				if ($arData['EventType'] == 2)
					$arData['EventType'] = 0;

				if ($arData['EventType'] > 2 /* || ($arData['EventType'] == 1 && !$arData['RecurrenceData'])*/)
					return new CSoapFault(
						'Unsupported event type',
						'Event type unsupported'
					);

				$arData['fRecurrence'] = intval($arData['fRecurrence']);
				$arData['RRULE'] = '';

				$id = $arData['_command'] == 'New' ? 0 : intVal($arData['ID']);
				if ($arData['RecurrenceData'])
				{
					//$xmlstr = $arData['XMLTZone'];
					//$arData['XMLTZone'] = new CDataXML();
					//$arData['XMLTZone']->LoadString($xmlstr);

					$xmlstr = $arData['RecurrenceData'];
					$obRecurData = new CDataXML();
					$obRecurData->LoadString($xmlstr);

/*
<recurrence>
		<rule>
			<firstDayOfWeek>mo</firstDayOfWeek>
			<repeat>
				<weekly mo='TRUE' tu='TRUE' th='TRUE' sa='TRUE' weekFrequency='1' />
			</repeat>
			<repeatForever>FALSE</repeatForever>
		</rule>
</recurrence>
<deleteExceptions>true</deleteExceptions>
*/

					$obRecurRule = $obRecurData->tree->children[0]->children[0];
					$obRecurRepeat = $obRecurRule->children[1];
					$obNode = $obRecurRepeat->children[0];

					$arData['RRULE'] = array();
					switch($obNode->name)
					{
						case 'daily':
							// hack. we have no "work days" daily recurence
							if ($obNode->getAttribute('weekday') == 'TRUE')
							{
								$arData['RRULE']['FREQ'] = 'WEEKLY';
								$arData['RRULE']['BYDAY'] = 'MO,TU,WE,TH,FR';
								$arData['RRULE']['INTERVAL'] = 1;
							}
							else
							{
								$arData['RRULE']['FREQ'] = 'DAILY';
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:67,代码来源:webservice.php

示例11: SendRequest

 /**
  * @param array[string]string $arSettings
  * @param string $verb
  * @param string $bucket
  * @param string $file_name
  * @param string $params
  * @param string $content
  * @param array[string]string $additional_headers
  * @return mixed
  */
 public function SendRequest($arSettings, $verb, $bucket, $file_name = '/', $params = '', $content = '', $additional_headers = array())
 {
     global $APPLICATION;
     $this->status = 0;
     if (isset($additional_headers["Content-Type"])) {
         $ContentType = $additional_headers["Content-Type"];
         unset($additional_headers["Content-Type"]);
     } else {
         $ContentType = $content != "" ? 'text/plain' : '';
     }
     foreach ($this->set_headers as $key => $value) {
         $additional_headers[$key] = $value;
     }
     if (array_key_exists("SESSION_TOKEN", $arSettings)) {
         $additional_headers["x-amz-security-token"] = $arSettings["SESSION_TOKEN"];
     }
     ksort($additional_headers);
     $RequestURI = $file_name;
     $obRequest = new CHTTP();
     if (isset($additional_headers["option-file-result"])) {
         $obRequest->fp = $additional_headers["option-file-result"];
     }
     foreach ($this->SignRequest($arSettings, $verb, $bucket, $file_name, $ContentType, $additional_headers) as $key => $value) {
         $obRequest->additional_headers[$key] = $value;
     }
     foreach ($additional_headers as $key => $value) {
         if (preg_match("/^option-/", $key) == 0) {
             $obRequest->additional_headers[$key] = $value;
         }
     }
     if ($this->new_end_point != "" && preg_match('#^(http|https)://' . preg_quote($bucket, '#') . '(.+?)/#', $this->new_end_point, $match) > 0) {
         $host = $bucket . $match[2];
     } elseif ($this->location) {
         $host = $bucket . "." . $this->location . ".amazonaws.com";
     } else {
         $host = $bucket . ".s3.amazonaws.com";
     }
     $was_end_point = $this->new_end_point;
     $this->new_end_point = '';
     $obRequest->Query($verb, $host, 80, $RequestURI . $params, $content, '', $ContentType);
     $this->status = $obRequest->status;
     $this->host = $host;
     $this->verb = $verb;
     $this->url = $RequestURI . $params;
     $this->headers = $obRequest->headers;
     $this->errno = $obRequest->errno;
     $this->errstr = $obRequest->errstr;
     $this->result = $obRequest->result;
     if ($obRequest->status == 200) {
         if (isset($additional_headers["option-raw-result"]) || isset($additional_headers["option--result"])) {
             return $obRequest->result;
         } elseif ($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
             $e = new CApplicationException(GetMessage('CLO_STORAGE_S3_XML_PARSE_ERROR', array('#errno#' => '1')));
             $APPLICATION->ThrowException($e);
             return false;
         } else {
             //Empty success result
             return array();
         }
     } elseif ($obRequest->status == 307 && isset($obRequest->headers["Location"]) && $was_end_point === "") {
         $this->new_end_point = $obRequest->headers["Location"];
         return $this->SendRequest($arSettings, $verb, $bucket, $file_name, $params, $content, $additional_headers);
     } elseif ($obRequest->status > 0) {
         if ($obRequest->result != "") {
             $obXML = new CDataXML();
             if ($obXML->LoadString($obRequest->result)) {
                 $node = $obXML->SelectNodes("/Error/Message");
                 if (is_object($node)) {
                     $errmsg = trim($node->textContent(), '.');
                     $e = new CApplicationException(GetMessage('CLO_STORAGE_S3_XML_ERROR', array('#errmsg#' => $errmsg)));
                     $APPLICATION->ThrowException($e);
                     return false;
                 }
             }
         }
         $e = new CApplicationException(GetMessage('CLO_STORAGE_S3_XML_PARSE_ERROR', array('#errno#' => '2')));
         $APPLICATION->ThrowException($e);
         return false;
     } else {
         $e = new CApplicationException(GetMessage('CLO_STORAGE_S3_XML_PARSE_ERROR', array('#errno#' => '3')));
         $APPLICATION->ThrowException($e);
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:storage_service_s3.php

示例12: GetBoardFromSite

 function GetBoardFromSite($queryParameters)
 {
     $result = array();
     $result = CAirportBoard::GetOneBoardFromSite($queryParameters, "");
     $res = $result["HTML"];
     unset($result["HTML"]);
     /*// Ниже код для загрузки табло за сутки (используется три запроса с последующей склейкой)
       $result = CAirportBoard::GetOneBoardFromSite( $queryParameters, "v=3" );
       $res = $result["HTML"];
       unset($result["HTML"]);
       $result2 = CAirportBoard::GetOneBoardFromSite( $queryParameters, "v=11" );
       $res .= $result2["HTML"];
       unset($result2["HTML"]);
       $result3 = CAirportBoard::GetOneBoardFromSite( $queryParameters, "v=19" );
       $res .= $result3["HTML"];
       unset($result3["HTML"]);
       
       if ( intval($result2["ERROR"]["CODE"]) )
       {
         $result["ERROR"] = $result2["ERROR"];
       } elseif ( intval($result3["ERROR"]["CODE"]) )
       {
         $result["ERROR"] = $result3["ERROR"];
       }
       */
     if (!intval($result["ERROR"]["CODE"])) {
         $res = '<table>' . $res . '</table>';
         $res = str_replace("<br>", " ", $res);
         $res = str_replace("<nobr>", "", $res);
         $res = str_replace("</nobr>", "", $res);
         //trace($res);
         $xml = new CDataXML();
         if ($xml->LoadString($res)) {
             $node = $xml->SelectNodes("/table");
             $rows = $node->elementsByName("tr");
             $akNames = array();
             $akCodes = array();
             $departures = array();
             $arrivals = array();
             $terminals = array();
             $i = 0;
             foreach ($rows as $row) {
                 if (strstr($row->getAttribute("class"), "tr0")) {
                     $cells = $row->elementsByName("td");
                     // Определяем код авиакомпании и номер рейса
                     preg_match_all("/([A-Za-zА-Яа-я0-9]{2})\\s*([0-9]+)\\s*/", $cells[0]->content, $flightNumber, PREG_PATTERN_ORDER);
                     $cityPatterns = array("/([\\W\\d]+)\\(/", "/\\s+\\)\\s*/");
                     $cityReplace = array("\$1 (", ")");
                     $result["FLIGHTS"][$i] = array("FLIGHT" => array("AK_CODE" => $flightNumber[1][0], "NUMBER" => $flightNumber[2][0]), "AK_NAME" => "", "DEPARTURE" => htmlspecialcharsEx(preg_replace($cityPatterns, $cityReplace, $cells[1]->content)), "ARRIVAL" => htmlspecialcharsEx(preg_replace($cityPatterns, $cityReplace, $cells[1]->content)), "STATUS" => CAirportBoard::GetStatusInfo($cells[5]->content), "TIME" => array("PLANNED" => CAirportBoard::GetDateTimeArray($cells[2]->content), "ESTIMATED" => "", "ACTUAL" => CAirportBoard::GetDateTimeArray($cells[3]->content)), "TERMINAL" => "");
                     // Формируем список уникальных терминалов и пунктов вылета и прилета для фильтра
                     if (!in_array($flightNumber[1][0], $akCodes)) {
                         $akCodes[] = $flightNumber[1][0];
                     }
                     if (!in_array($result["FLIGHTS"][$i]["DEPARTURE"], $departures)) {
                         $departures[] = $result["FLIGHTS"][$i]["DEPARTURE"];
                     }
                     if (!in_array($result["FLIGHTS"][$i]["ARRIVAL"], $arrivals)) {
                         $arrivals[] = $result["FLIGHTS"][$i]["ARRIVAL"];
                     }
                     $i++;
                 }
             }
             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;
 }
开发者ID:slavaskazochnik,项目名称:vnukovo-transagency,代码行数:76,代码来源:dme.php

示例13: gdGetRss

function gdGetRss($rss_url, $cache_time = 0)
{
    /** @global CMain $APPLICATION */
    global $APPLICATION;
    $cache = new CPHPCache();
    if (!$cache->StartDataCache($cache_time, 'c' . $rss_url, "gdrss")) {
        $v = $cache->GetVars();
        return $v['oRss'];
    }
    $oRssFeeds = new gdRssFeeds();
    $ob = new CHTTP();
    $ob->http_timeout = 10;
    $ob->setFollowRedirect(true);
    $ob->HTTPQuery("GET", $rss_url);
    $res = $ob->result;
    if (!$res) {
        $cache->EndDataCache(array("oRss" => false));
        return false;
    }
    if (preg_match("/<" . "\\?XML[^>]{1,}encoding=[\"']([^>\"']{1,})[\"'][^>]{0,}\\?" . ">/i", $res, $matches)) {
        $charset = trim($matches[1]);
        $res = $APPLICATION->ConvertCharset($res, $charset, SITE_CHARSET);
    }
    $xml = new CDataXML();
    $xml->LoadString($res);
    $oNode = $xml->SelectNodes("/rss/channel/title");
    if (!$oNode) {
        $cache->EndDataCache(array("oRss" => false));
        return false;
    }
    $oRssFeeds->title = $oNode->content;
    if (trim($oRssFeeds->title) == '') {
        if ($oSubNode = $oNode->elementsByName("cdata-section")) {
            $oRssFeeds->title = $oSubNode[0]->content;
        }
    }
    if ($oNode = $xml->SelectNodes("/rss/channel/link")) {
        $oRssFeeds->link = $oNode->content;
    }
    if ($oNode = $xml->SelectNodes("/rss/channel/description")) {
        $oRssFeeds->description = $oNode->content;
    }
    if (trim($oRssFeeds->description) == '') {
        if ($oNode && ($oSubNode = $oNode->elementsByName("cdata-section"))) {
            $oRssFeeds->description = $oSubNode[0]->content;
        }
    }
    if ($oNode = $xml->SelectNodes("/rss/channel/pubDate")) {
        $oRssFeeds->pubDate = $oNode->content;
    } elseif ($oNode = $xml->SelectNodes("/rss/channel/lastBuildDate")) {
        $oRssFeeds->pubDate = $oNode->content;
    }
    if ($oNode = $xml->SelectNodes("/rss/channel")) {
        $oNodes = $oNode->elementsByName("item");
        foreach ($oNodes as $oNode) {
            $item = array();
            if ($oSubNode = $oNode->elementsByName("title")) {
                $item["TITLE"] = $oSubNode[0]->content;
            }
            if (trim($item["TITLE"]) == '' && !empty($oSubNode)) {
                if ($oSubNode = $oSubNode[0]->elementsByName("cdata-section")) {
                    $item["TITLE"] = $oSubNode[0]->content;
                }
            }
            if ($oSubNode = $oNode->elementsByName("link")) {
                $item["LINK"] = $oSubNode[0]->content;
            }
            if ($oSubNode = $oNode->elementsByName("pubDate")) {
                $item["PUBDATE"] = $oSubNode[0]->content;
            }
            if ($oSubNode = $oNode->elementsByName("description")) {
                $item["DESCRIPTION"] = $oSubNode[0]->content;
            }
            if (trim($item["DESCRIPTION"]) == '' && !empty($oSubNode)) {
                if ($oSubNode = $oSubNode[0]->elementsByName("cdata-section")) {
                    $item["DESCRIPTION"] = $oSubNode[0]->content;
                }
            }
            if ($oSubNode = $oNode->elementsByName("author")) {
                $item["AUTHOR"] = $oSubNode[0]->content;
            }
            if (trim($item["AUTHOR"]) == '' && !empty($oSubNode)) {
                if ($oSubNode = $oSubNode[0]->elementsByName("cdata-section")) {
                    $item["AUTHOR"] = $oSubNode[0]->content;
                }
            }
            $oRssFeeds->items[] = $item;
        }
    }
    $cache->EndDataCache(array("oRss" => $oRssFeeds));
    return $oRssFeeds;
}
开发者ID:spas-viktor,项目名称:books,代码行数:92,代码来源:include.php

示例14: mktime

} else {
    $url = 'ts=' . mktime();
}
$cache = new CPageCache();
if ($arGadgetParams["CACHE_TIME"] > 0 && !$cache->StartDataCache($arGadgetParams["CACHE_TIME"], 'c' . $arGadgetParams["CITY"], "gdprobki")) {
    return;
}
$ob = new CHTTP();
$ob->http_timeout = 10;
$ob->Query("GET", "export.yandex.ru", 80, "/bar/reginfo.xml?" . $url, false, "", "N");
$errno = $ob->errno;
$errstr = $ob->errstr;
$res = $ob->result;
$res = str_replace("−", "-", $res);
$xml = new CDataXML();
$xml->LoadString($APPLICATION->ConvertCharset($res, 'UTF-8', SITE_CHARSET));
$node = $xml->SelectNodes('/info/traffic/title');
?>
<h3><?php 
echo $node->content;
?>
</h3>
<table width="90%"><tr>
<td width="80%" nowrap>
<?php 
$node = $xml->SelectNodes('/info/traffic/hint');
?>
<span class="gdtrafic"><?php 
echo $node->content;
?>
</span><br>
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:index.php

示例15: ShowError

// при ошибке запроса
if ($client->getResponseThemeName() == 'error') {
    CHTTP::SetStatus("404 Not Found");
    // TODO: получать message из ответа сервера
    ShowError(GetMessage('MAX_NOT_FOUND'));
    return;
}
if (mb_strtolower(SITE_CHARSET) != 'utf-8') {
    $data = iconv('utf-8', SITE_CHARSET, $domXml);
} else {
    $data = $domXml;
}
$xml = new CDataXML();
// Лучше бы через
// $xml->Load('/path/to/file');
$xml->LoadString($data);
// получаем данные
/**
 * В минимальном варианте:
 * - фото
 * - марка
 * - модель
 * - год выпуска
 * + объём двигателя
 * - пробег
 * - цена
 */
$arVehicles = array();
$xmlVehicles = $xml->SelectNodes('/response/vehicles');
$i = 0;
if ($xmlVehicles && is_object($xmlVehicles)) {
开发者ID:ASDAFF,项目名称:Bitrix-Module,代码行数:31,代码来源:component.php


注:本文中的CDataXML::LoadString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。