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


PHP CHTTP::PrepareData方法代码示例

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


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

示例1: getUrl

 /**
  * @param string $hash
  * @param string $act
  * @return string
  */
 public function getUrl($hash, $act = "view")
 {
     return \CHTTP::URN2URI($this->script . (strpos($this->script, "?") === false ? "?" : "&") . \CHTTP::PrepareData(array(self::INFO_NAME => array("CID" => $this->CID, "mode" => $act, "hash" => $hash))));
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:uploader.php

示例2: batch

 public function batch($actions)
 {
     $arBatch = array();
     if (is_array($actions)) {
         foreach ($actions as $query_key => $arCmd) {
             list($cmd, $arParams) = array_values($arCmd);
             $arBatch['cmd'][$query_key] = $cmd . '?' . CHTTP::PrepareData($arParams);
         }
     }
     $arBatch['auth'] = $this->access_token;
     $batch_url = '/rest/batch';
     $httpClient = new \Bitrix\Main\Web\HttpClient();
     $result = $httpClient->post($this->portalURI . $batch_url, $arBatch);
     return $this->prepareAnswer($result);
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:15,代码来源:bitrix24.php

示例3: 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;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:23,代码来源:vi_http.php

示例4: 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;
 }
开发者ID:vim84,项目名称:b-markt,代码行数:14,代码来源:pull_push.php

示例5: 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;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:65,代码来源:pull_channel.php

示例6: PrepareData

 function PrepareData($arPostData, $prefix = '')
 {
     $str = '';
     if (!is_array($arPostData)) {
         $str = $arPostData;
     } else {
         foreach ($arPostData as $key => $value) {
             $name = $prefix == "" ? urlencode($key) : $prefix . "[" . urlencode($key) . "]";
             if (is_array($value)) {
                 $str .= CHTTP::PrepareData($value, $name);
             } else {
                 $str .= '&' . $name . '=' . urlencode($value);
             }
         }
     }
     if ($prefix == '' && substr($str, 0, 1) == '&') {
         $str = substr($str, 1);
     }
     return $str;
 }
开发者ID:gitkv,项目名称:bash,代码行数:20,代码来源:tools.php

示例7: 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;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:57,代码来源:pull_channel.php


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