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


PHP CHTTP::HTTPQuery方法代码示例

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


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

示例1: AddByChannel

	public static function AddByChannel($channelId, $arMessage)
	{
		global $DB;

		if (strlen($arMessage['module_id'])<=0 || strlen($arMessage['command'])<=0)
			return false;


		$arData = Array(
			'module_id' => $arMessage['module_id'],
			'command' => $arMessage['command'],
			'params' => is_array($arMessage['params'])?$arMessage['params']: Array(),
		);
		if (CPullOptions::GetNginxStatus())
		{
			$message = CUtil::PhpToJsObject(Array('CHANNEL_ID' => $channelId, 'MESSAGE' => Array($arData), 'ERROR' => ''));
			if (!defined('BX_UTF') || !BX_UTF)
				$message = $GLOBALS['APPLICATION']->ConvertCharset($message, SITE_CHARSET,'utf-8');

			$CHTTP = new CHTTP();
			$CHTTP->http_timeout = 10;
			if ($CHTTP->HTTPQuery('POST', CPullOptions::GetPublishUrl($channelId), str_replace("\n", " ", $message)))
				$result = $CHTTP->result;
		}
		else
		{
			$arParams = Array(
				'CHANNEL_ID' => $channelId,
				'MESSAGE' => str_replace("\n", " ", serialize($arData)),
				'~DATE_CREATE' => $DB->CurrentTimeFunction(),
			);
			$id = IntVal($DB->Add("b_pull_stack", $arParams, Array("MESSAGE")));
			$result = $id? '{"channel": "'.$channelId.'", "id": "'.$id.'"}': false;
		}

		if (isset($arMessage['push_text']) && strlen($arMessage['push_text'])>0
		&& isset($arMessage['push_user']) && intval($arMessage['push_user'])>0)
		{
			$CPushManager = new CPushManager();
			$CPushManager->AddQueue(Array(
				'USER_ID' => $arMessage['push_user'],
				'MESSAGE' => str_replace("\n", " ", $arMessage['push_text']),
				'PARAMS' => $arMessage['push_params'],
				'TAG' => isset($arMessage['push_tag'])? $arMessage['push_tag']: '',
			));
		}

		return $result;
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:49,代码来源:pull_stack.php

示例2: removeFile

 public function removeFile(array $fileData)
 {
     $accessToken = $this->getAccessToken();
     $fileId = $fileData['id'];
     $http = new CHTTP();
     $http->http_timeout = 10;
     if (!$http->HTTPQuery('DELETE', "https://apis.live.net/v5.0/{$fileId}?access_token=" . urlencode($accessToken))) {
         return false;
     }
     // error checking
     if ($http->status != "200") {
         return false;
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:15,代码来源:editskydrive.php

示例3: Add

 public static function Add($userId)
 {
     global $DB, $APPLICATION;
     $channelId = md5(uniqid() . $_SERVER["REMOTE_ADDR"] . $_SERVER["SERVER_NAME"] . (is_object($APPLICATION) ? $APPLICATION->GetServerUniqID() : ''));
     $arParams = array('USER_ID' => intval($userId), 'CHANNEL_ID' => $channelId, 'LAST_ID' => 0, '~DATE_CREATE' => $DB->CurrentTimeFunction());
     $result = IntVal($DB->Add("b_pull_channel", $arParams, array()));
     if (CPullOptions::GetNginxStatus()) {
         $result = false;
         $arData = array('module_id' => 'pull', 'command' => 'open', 'params' => array());
         $CHTTP = new CHTTP();
         $CHTTP->http_timeout = 10;
         if ($CHTTP->HTTPQuery('POST', CPullOptions::GetPublishUrl($channelId), CUtil::PhpToJsObject(array('MESSAGE' => array($arData), 'ERROR' => '')))) {
             $result = $CHTTP->result;
         }
     }
     return $result ? $channelId : false;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:17,代码来源:pull_channel.php

示例4: AddByChannel

 public static function AddByChannel($channelId, $arMessage)
 {
     global $DB;
     if (strlen($arMessage['module_id']) <= 0 || strlen($arMessage['command']) <= 0) {
         return false;
     }
     $arData = array('module_id' => $arMessage['module_id'], 'command' => $arMessage['command'], 'params' => is_array($arMessage['params']) ? $arMessage['params'] : array());
     if (CPullOptions::GetNginxStatus()) {
         $CHTTP = new CHTTP();
         $CHTTP->http_timeout = 10;
         if ($CHTTP->HTTPQuery('POST', CPullOptions::GetPublishUrl($channelId), str_replace("\n", " ", CUtil::PhpToJsObject(array('CHANNEL_ID' => $channelId, 'MESSAGE' => array($arData), 'ERROR' => ''))))) {
             $result = $CHTTP->result;
         }
     } else {
         $arParams = array('CHANNEL_ID' => $channelId, 'MESSAGE' => str_replace("\n", " ", serialize($arData)), '~DATE_CREATE' => $DB->CurrentTimeFunction());
         $id = IntVal($DB->Add("b_pull_stack", $arParams, array("MESSAGE")));
         $result = $id ? '{"channel": "' . $channelId . '", "id": "' . $id . '"}' : false;
     }
     if (isset($arMessage['push_text']) && strlen($arMessage['push_text']) > 0 && isset($arMessage['push_user']) && intval($arMessage['push_user']) > 0) {
         $CPushManager = new CPushManager();
         $CPushManager->AddQueue(array('USER_ID' => $arMessage['push_user'], 'MESSAGE' => str_replace("\n", " ", $arMessage['push_text']), 'PARAMS' => $arMessage['push_params'], 'TAG' => isset($arMessage['push_tag']) ? $arMessage['push_tag'] : ''));
     }
     return $result;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:24,代码来源:pull_stack.php

示例5: 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

示例6: CheckDirPath

 //1M
 $arFile = CFile::GetFileArray($ar["ID"]);
 $filePath = preg_replace("#[\\\\\\/]+#", "/", "/" . $arFile["SUBDIR"] . "/" . $arFile["FILE_NAME"]);
 $absPath = preg_replace("#[\\\\\\/]+#", "/", $_SERVER["DOCUMENT_ROOT"] . "/" . COption::GetOptionString("main", "upload_dir", "upload") . $filePath);
 $absPath = $io->GetPhysicalName($absPath);
 $absTempPath = $absPath . "~";
 if (!file_exists($absPath)) {
     CheckDirPath($absTempPath);
     $obRequest = new CHTTP();
     $obRequest->follow_redirect = true;
     $obRequest->fp = fopen($absTempPath, "ab");
     if (is_resource($obRequest->fp)) {
         if ($arFile["FILE_SIZE"] > $maxPartSize) {
             $obRequest->additional_headers["Range"] = sprintf("bytes=%u-%u", $last_file_pos, ($last_file_pos + $maxPartSize > $arFile["FILE_SIZE"] ? $arFile["FILE_SIZE"] : $last_file_pos + $maxPartSize) - 1);
         }
         $res = $obRequest->HTTPQuery('GET', $ob->GetFileSRC($arFile));
         fclose($obRequest->fp);
         unset($obRequest->fp);
         if ($res && ($obRequest->status == 200 || $obRequest->status == 206)) {
             $bFileMoved = true;
             if ($arFile["FILE_SIZE"] > $maxPartSize) {
                 $last_file_pos += $maxPartSize;
                 $_SESSION["last_file_pos"] = $last_file_pos;
                 $bNextFile = false;
             } else {
                 $last_file_pos = $arFile["FILE_SIZE"];
             }
             if (array_key_exists("Content-Range", $obRequest->headers) && preg_match("/(\\d+)-(\\d+)\\/(\\d+)\$/", $obRequest->headers["Content-Range"], $match)) {
                 $FILE_SIZE = $match[3];
             } elseif (array_key_exists("Content-Length", $obRequest->headers) && preg_match("/^(\\d+)\$/", $obRequest->headers["Content-Length"], $match) && $match[1] > $maxPartSize) {
                 $FILE_SIZE = 0;
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:clouds_storage_list.php


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