本文整理汇总了PHP中CHTTP::sPost方法的典型用法代码示例。如果您正苦于以下问题:PHP CHTTP::sPost方法的具体用法?PHP CHTTP::sPost怎么用?PHP CHTTP::sPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHTTP
的用法示例。
在下文中一共展示了CHTTP::sPost方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetAccessToken
public function GetAccessToken($redirect_uri)
{
if($this->code === false)
return false;
$result = CHTTP::sPost(self::TOKEN_URL, array(
"code"=>$this->code,
"client_id"=>$this->appID,
"client_secret"=>$this->appSecret,
"redirect_uri"=>$redirect_uri,
"grant_type"=>"authorization_code",
));
$arResult = CUtil::JsObjectToPhp($result);
if(isset($arResult["access_token"]) && $arResult["access_token"] <> '')
{
$this->access_token = $arResult["access_token"];
$_SESSION["OAUTH_DATA"] = array("OATOKEN" => $this->access_token);
return true;
}
return false;
}
示例2: GetAccessToken
public function GetAccessToken()
{
if(!$this->token || !$this->tokenVerifier || !$this->tokenSecret)
return false;
$arParams = array_merge($this->GetDefParams(), array(
"oauth_token" => $this->token,
"oauth_verifier" => $this->tokenVerifier,
));
$arParams["oauth_signature"] = $this->BuildSignature($this->GetSignatureString($arParams, self::TOKEN_URL));
$result = CHTTP::sPost(self::TOKEN_URL, $arParams);
parse_str($result, $arResult);
if(isset($arResult["oauth_token"]) && $arResult["oauth_token"] <> '')
{
$this->token = $arResult["oauth_token"];
$this->tokenSecret = $arResult["oauth_token_secret"];
return $arResult;
}
return false;
}
示例3: Validate
public function Validate()
{
if (CSocServAuthManager::CheckUniqueKey()) {
if ($arOpenidServerTags = $this->GetOpenIDServerTags($_GET['openid_identity'])) {
$arParams = array('openid.assoc_handle' => $_GET['openid_assoc_handle'], 'openid.signed' => $_GET['openid_signed'], 'openid.sig' => $_GET['openid_sig']);
$arSigned = explode(',', $_GET['openid_signed']);
foreach ($arSigned as $s) {
$arParams['openid.' . $s] = $_GET['openid_' . str_replace('.', '_', $s)];
}
$arParams['openid.mode'] = 'check_authentication';
if (isset($_SESSION['BX_OPENID_RETURN_TO'])) {
$arParams['openid.return_to'] = $_SESSION['BX_OPENID_RETURN_TO'];
unset($_SESSION['BX_OPENID_RETURN_TO']);
}
$str = CHTTP::sPost($arOpenidServerTags['server'], $arParams, true);
if (preg_match('/is_valid\\s*\\:\\s*/' . BX_UTF_PCRE_MODIFIER, $str)) {
return array('server' => $arOpenidServerTags['server'], 'identity' => $_GET['openid_identity']);
} else {
$GLOBALS['APPLICATION']->ThrowException(GetMessage('OPENID_CLIENT_ERROR_AUTH'));
}
}
}
// self::CleanParam('ERROR');
$GLOBALS['APPLICATION']->ThrowException(GetMessage('OPENID_CLIENT_ERROR_AUTH'));
return false;
}
示例4: Validate
function Validate()
{
if ($arOpenidServerTags = $this->GetOpenIDServerTags($_GET['openid_identity']))
{
$arParams = array(
'openid.assoc_handle' => $_GET['openid_assoc_handle'],
'openid.signed' => $_GET['openid_signed'],
'openid.sig' => $_GET['openid_sig'],
);
$arSigned = explode(',', $_GET['openid_signed']);
foreach ($arSigned as $s)
$arParams['openid.' . $s] = $_GET['openid_' . str_replace('.', '_', $s)];
$arParams['openid.mode'] = 'check_authentication';
$str = CHTTP::sPost($arOpenidServerTags['server'], $arParams, true);
if (preg_match('/is_valid\s*\:\s*true/' . BX_UTF_PCRE_MODIFIER, $str))
{
return array(
'server' => $arOpenidServerTags['server'],
'identity' => $_GET['openid_identity']
);
}
else
{
$GLOBALS['APPLICATION']->ThrowException(GetMessage('OPENID_CLIENT_ERROR_AUTH'));
}
}
return false;
}
示例5: SendFeed
public function SendFeed($socServUserId, $message)
{
if(!$this->access_token || !$this->userId)
self::SetOauthKeys($socServUserId);
$message = CharsetConverter::ConvertCharset($message, LANG_CHARSET, "utf-8");
$arPost = array("access_token" => $this->access_token, "message"=> $message);
$result = CHTTP::sPost($this::GRAPH_URL."/".$this->userId."/feed", $arPost);
if(!defined("BX_UTF"))
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
return CUtil::JsObjectToPhp($result);
}
示例6: GetAccessToken
public function GetAccessToken($redirect_uri)
{
if($this->code === false)
return false;
$result = CHTTP::sPost(self::TOKEN_URL, array(
"client_id"=>$this->appID,
"client_secret"=>$this->appSecret,
"code"=>$this->code,
"redirect_uri"=>$redirect_uri,
));
$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"];
return true;
}
return false;
}
示例7: RefreshToken
private function RefreshToken($socServUserId)
{
$result = CHTTP::sPost(self::TOKEN_URL, array(
"refresh_token"=>$this->refresh_token,
"client_id"=>$this->appID,
"client_secret"=>$this->appSecret,
"grant_type"=>"refresh_token",
));
$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;
}
示例8: GetAccessToken
public function GetAccessToken($redirect_uri)
{
if($this->code === false)
return false;
$result = CHTTP::sPost(self::TOKEN_URL, array(
"code"=>$this->code,
"client_id"=>$this->appID,
"client_secret"=>$this->appSecret,
"redirect_uri"=>$redirect_uri,
"grant_type"=>"authorization_code",
));
$arResult = CUtil::JsObjectToPhp($result);
if(isset($arResult["access_token"]) && $arResult["access_token"] <> '')
{
$this->access_token = $arResult["access_token"];
$arguments = array();
$arguments["application_key"] = $this->appKey;
$arguments['method'] = 'users.getCurrentUser';
ksort($arguments);
$this->sign = strtolower(md5('application_key='.$arguments["application_key"].'method='.$arguments['method'].md5($this->access_token.$this->appSecret)));
return true;
}
return false;
}