當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CHTTP::setFollowRedirect方法代碼示例

本文整理匯總了PHP中CHTTP::setFollowRedirect方法的典型用法代碼示例。如果您正苦於以下問題:PHP CHTTP::setFollowRedirect方法的具體用法?PHP CHTTP::setFollowRedirect怎麽用?PHP CHTTP::setFollowRedirect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CHTTP的用法示例。


在下文中一共展示了CHTTP::setFollowRedirect方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendRequest

	/**
	 * Send request to Bitrix (check o receive)
	 * @param array $pPayload
	 * @return array|bool
	 */
	protected static function sendRequest(array $pPayload)
	{
		$request = new CHTTP();
		$request->http_timeout = self::CONNECTION_TIMEOUT;
		$request->setFollowRedirect(true);
		@$request->Post(self::getCheckerUrl(), $pPayload);
		if($request->status === 200 && $request->result)
		{
			return self::decodeResponse($request->result);	
		}
		else
		{
			return false;
		}
	}
開發者ID:ASDAFF,項目名稱:bxApiDocs,代碼行數:20,代碼來源:cloud_monitor_request.php

示例2: sPost

	public static function sPost($url, $arPostData, $follow_redirect = false) //static post
	{
		$ob = new CHTTP();
		$ob->setFollowRedirect($follow_redirect);
		return $ob->Post($url, $arPostData);
	}
開發者ID:nProfessor,項目名稱:Mytb,代碼行數:6,代碼來源:tools.php

示例3: queryOld

 protected function queryOld($scope, $method = "GET", $data = null, $skipRefreshAuth = false)
 {
     if ($this->engineSettings['AUTH']) {
         $http = new \CHTTP();
         $http->setAdditionalHeaders(array('Authorization' => 'OAuth ' . $this->engineSettings['AUTH']['access_token']));
         $http->setFollowRedirect(false);
         switch ($method) {
             case 'GET':
                 $result = $http->get($scope);
                 break;
             case 'POST':
                 $result = $http->post($scope, $data);
                 break;
             case 'PUT':
                 $result = $http->httpQuery($method, $scope, $http->prepareData($data));
                 break;
             case 'DELETE':
                 break;
         }
         if ($http->status == 401 && !$skipRefreshAuth) {
             if ($this->checkAuthExpired(false)) {
                 $this->queryOld($scope, $method, $data, true);
             }
         }
         $http->result = Text\Encoding::convertEncoding($http->result, 'utf-8', LANG_CHARSET);
         return $http;
     }
 }
開發者ID:webgksupport,項目名稱:alpina,代碼行數:28,代碼來源:yandex.php

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

示例5: CHTTP

         $this->IncludeComponentTemplate('sync');
     }
     break;
 case 'test':
     if (!check_bitrix_sessid()) {
         return;
     }
     $sp_server = $_REQUEST['sp_server'];
     $sp_user = $_REQUEST['sp_user'];
     $sp_pass = $_REQUEST['sp_pass'];
     $arResult['SERVER'] = 0;
     $arResult['AUTH'] = 0;
     if ($sp_server && $sp_server != 'http://' && ($URL = CHTTP::ParseURL($sp_server))) {
         if ($URL['host'] && $URL['scheme'] == 'http') {
             $ob = new CHTTP();
             $ob->setFollowRedirect(false);
             if ($sp_user) {
                 $ob->SetAuthBasic($sp_user, $sp_pass);
             }
             if ($ob->Get($sp_server) !== false) {
                 if ($ob->status == 200 || $ob->status == 302 || $ob->status == 401) {
                     $arResult['SERVER'] = 1;
                     if ($ob->status != 401) {
                         $arResult['AUTH'] = 1;
                     }
                 }
             }
         }
     }
     $this->IncludeComponentTemplate('form_server_test');
     break;
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:31,代碼來源:component.php


注:本文中的CHTTP::setFollowRedirect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。