本文整理汇总了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;
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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;