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


PHP CHTTP::sPostHeader方法代码示例

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


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

示例1: SendFeed

 public function SendFeed($socServUserId, $message, $messageId)
 {
     $isSetOauthKeys = true;
     if (!$this->access_token || !$this->userId) {
         $isSetOauthKeys = self::SetOauthKeys($socServUserId);
     }
     if ($isSetOauthKeys === false) {
         CSocServMessage::Delete($messageId);
         return false;
     }
     $message = CharsetConverter::ConvertCharset($message, LANG_CHARSET, "utf-8");
     $arPost = array("access_token" => $this->access_token, "message" => $message);
     $result = @CHTTP::sPostHeader($this::GRAPH_URL . "/" . $this->userId . "/feed", $arPost, array(), $this->httpTimeout);
     if ($result !== false) {
         if (!defined("BX_UTF")) {
             $result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
         }
         return CUtil::JsObjectToPhp($result);
     } else {
         return false;
     }
 }
开发者ID:spas-viktor,项目名称:books,代码行数:22,代码来源:facebook.php

示例2: RefreshToken

 private function RefreshToken($socServUserId)
 {
     $result = CHTTP::sPostHeader(self::TOKEN_URL, array("refresh_token" => $this->refresh_token, "client_id" => $this->appID, "client_secret" => $this->appSecret, "grant_type" => "refresh_token"), array(), $this->httpTimeout);
     $arResult = CUtil::JsObjectToPhp($result);
     if (isset($arResult["access_token"]) && $arResult["access_token"] != '') {
         $this->access_token = $arResult["access_token"];
         CSocServAuthDB::Update($socServUserId, array("OATOKEN" => $arResult["access_token"]));
         return true;
     }
     return false;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:11,代码来源:odnoklassniki.php

示例3: getNewAccessToken

 public function getNewAccessToken($refreshToken = false, $userId = 0, $save = false)
 {
     if ($this->appID == false || $this->appSecret == false) {
         return false;
     }
     if ($refreshToken == false) {
         $refreshToken = $this->refresh_token;
     }
     $result = CHTTP::sPostHeader(static::TOKEN_URL, array("refresh_token" => $refreshToken, "client_id" => $this->appID, "client_secret" => $this->appSecret, "grant_type" => "refresh_token"), array(), $this->httpTimeout);
     $this->arResult = CUtil::JsObjectToPhp($result);
     if (isset($this->arResult["access_token"]) && $this->arResult["access_token"] != '') {
         $this->access_token = $this->arResult["access_token"];
         $this->accessTokenExpires = $this->arResult["expires_in"] + time();
         if ($save && intval($userId) > 0) {
             $dbSocservUser = CSocServAuthDB::GetList(array(), array('USER_ID' => intval($userId), "EXTERNAL_AUTH_ID" => static::SERVICE_ID), false, false, array("ID"));
             if ($arOauth = $dbSocservUser->Fetch()) {
                 CSocServAuthDB::Update($arOauth["ID"], array("OATOKEN" => $this->access_token, "OATOKEN_EXPIRES" => $this->accessTokenExpires));
             }
         }
         return true;
     }
     return false;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:23,代码来源:google.php

示例4: GetAccessToken

	public function GetAccessToken()
	{
		if(($tokens = $this->getStorageTokens()) && is_array($tokens))
		{
			$this->access_token = $tokens["OATOKEN"];
			if($this->checkAccessToken())
			{
				return true;
			}
			elseif(isset($tokens["REFRESH_TOKEN"]))
			{
				if($this->getNewAccessToken($tokens["REFRESH_TOKEN"]))
				{
					return true;
				}
			}
		}

		if($this->code === false)
			return false;

		$result = CHTTP::sPostHeader(self::TOKEN_URL, array(
			"grant_type"=>"authorization_code",
			"code"=>$this->code,
			"client_id" => $this->appID,
		), array(
			"Authorization" => "Basic ".base64_encode($this->appID.':'.$this->appSecret)
		), $this->httpTimeout);

		echo $result;

		$this->arResult = CUtil::JsObjectToPhp($result);

		if(isset($this->arResult["access_token"]) && $this->arResult["access_token"] <> '')
		{
			// yandex doesn't send refresh tokens but I leave it here in case they will
			if(isset($this->arResult["refresh_token"]) && $this->arResult["refresh_token"] <> '')
			{
				$this->refresh_token = $this->arResult["refresh_token"];
			}
			$this->access_token = $this->arResult["access_token"];
			$this->accessTokenExpires = $this->arResult["expires_in"] + time();
			return true;
		}
		return false;
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:46,代码来源:yandex.php

示例5: GetAccessToken

	public function GetAccessToken($redirect_uri)
	{
		if($this->code === false)
			return false;

		$result = CHTTP::sPostHeader(self::TOKEN_URL, array(
			"client_id"=>$this->appID,
			"client_secret"=>$this->appSecret,
			"code"=>$this->code,
			"redirect_uri"=>$redirect_uri,
		), array(), $this->httpTimeout);

		$arResult = CUtil::JsObjectToPhp($result);

		if((isset($arResult["access_token"]) && $arResult["access_token"] <> '') && isset($arResult["user_id"]) && $arResult["user_id"] <> '')
		{
			$this->access_token = $arResult["access_token"];
			$this->userID = $arResult["user_id"];
			$_SESSION["OAUTH_DATA"] = array("OATOKEN" => $this->access_token);
			return true;
		}
		return false;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:23,代码来源:vkontakte.php

示例6: SendTwit

 public function SendTwit($socServUserId, $message, $messageId)
 {
     $isSetOauthKeys = true;
     if (!$this->token || !$this->tokenSecret) {
         $isSetOauthKeys = self::SetOauthKeys($socServUserId);
     }
     if ($isSetOauthKeys === false) {
         CSocServMessage::Delete($messageId);
         return false;
     }
     if (strlen($message) > 139) {
         $message = substr($message, 0, 137) . "...";
     }
     if (!defined("BX_UTF")) {
         $message = CharsetConverter::ConvertCharset($message, LANG_CHARSET, "utf-8");
     }
     $arParams = array_merge($this->GetDefParams(), array("oauth_token" => $this->token, "status" => $message));
     $arParams["oauth_signature"] = urlencode($this->BuildSignature($this->GetSignatureString($arParams, $this::POST_URL)));
     $arHeaders = array("Authorization" => 'OAuth oauth_consumer_key="' . $arParams["oauth_consumer_key"] . '", oauth_nonce="' . $arParams["oauth_nonce"] . '", oauth_signature="' . $arParams["oauth_signature"] . '", oauth_signature_method="HMAC-SHA1", oauth_timestamp="' . $arParams["oauth_timestamp"] . '", oauth_token="' . $this->token . '", oauth_version="1.0"');
     $arPost = array("status" => $message);
     $result = @CHTTP::sPostHeader($this::POST_URL, $arPost, $arHeaders, $this->httpTimeout);
     if ($result !== false) {
         if (!defined("BX_UTF")) {
             $result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
         }
         return CUtil::JsObjectToPhp($result);
     } else {
         return false;
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:30,代码来源:twitter.php

示例7: GetAccessToken

 public function GetAccessToken($redirect_uri)
 {
     $token = $this->getStorageTokens();
     if (is_array($token)) {
         $this->access_token = $token["OATOKEN"];
         return true;
     }
     if ($this->code === false) {
         return false;
     }
     $query = array("client_id" => $this->appID, "client_secret" => $this->appSecret, "code" => $this->code, "redirect_uri" => $redirect_uri);
     $result = CHTTP::sPostHeader(self::TOKEN_URL, $query, array(), $this->httpTimeout);
     $arResult = CUtil::JsObjectToPhp($result);
     if (isset($arResult["access_token"]) && $arResult["access_token"] != '' && isset($arResult["user_id"]) && $arResult["user_id"] != '') {
         $this->access_token = $arResult["access_token"];
         $this->userID = $arResult["user_id"];
         $this->userEmail = $arResult["email"];
         $_SESSION["OAUTH_DATA"] = array("OATOKEN" => $this->access_token);
         return true;
     }
     return false;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:22,代码来源:vkontakte.php

示例8: GetAccessToken

 public function GetAccessToken($redirect_uri)
 {
     if ($this->code === false) {
         return false;
     }
     $result = CHTTP::sPostHeader(self::TOKEN_URL, array("code" => $this->code, "client_id" => $this->appID, "client_secret" => $this->appSecret, "redirect_uri" => $redirect_uri, "grant_type" => "authorization_code"), array(), $this->httpTimeout);
     $arResult = CUtil::JsObjectToPhp($result);
     if (isset($arResult["access_token"]) && $arResult["access_token"] != '') {
         $this->access_token = $arResult["access_token"];
         return true;
     }
     return false;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:13,代码来源:google.php


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