本文整理匯總了PHP中OAuthUtil::Curl_Post方法的典型用法代碼示例。如果您正苦於以下問題:PHP OAuthUtil::Curl_Post方法的具體用法?PHP OAuthUtil::Curl_Post怎麽用?PHP OAuthUtil::Curl_Post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OAuthUtil
的用法示例。
在下文中一共展示了OAuthUtil::Curl_Post方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: userInfo
public function userInfo()
{
$recinfo = Openbiz::$app->getSessionContext()->getVar($this->type . '_access_token');
$postfields = array('access_token' => $recinfo['oauth_token'], 'format' => 'json');
$user = json_decode(OAuthUtil::Curl_Post($this->userUrl, $postfields), true);
if (!$user) {
return false;
}
$user['id'] = $user['userid'];
$user['type'] = $this->type;
$user['uname'] = $user['username'] . $this->suffix;
return $user;
}
示例2: callback
function callback()
{
//請求參數
$postfields = array('grant_type' => 'authorization_code', 'client_id' => $this->akey, 'client_secret' => $this->skey, 'code' => $_REQUEST['code'], 'redirect_uri' => $this->callBack);
$token = json_decode(OAuthUtil::Curl_Post($this->tokenUrl, $postfields), true);
if ($token['access_token']) {
$recinfo['oauth_token'] = $token['access_token'];
$recinfo['oauth_token_secret'] = '';
$recinfo['access_token_json'] = $token;
Openbiz::$app->getSessionContext()->setVar('alitao_access_token', $recinfo);
$userInfo = $this->userInfo();
$this->check($userInfo);
} else {
throw new Exception('驗證非法!');
return false;
}
}