本文整理汇总了PHP中SaeTOAuthV2::get方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeTOAuthV2::get方法的具体用法?PHP SaeTOAuthV2::get怎么用?PHP SaeTOAuthV2::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeTOAuthV2
的用法示例。
在下文中一共展示了SaeTOAuthV2::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_fp
public function get_fp($p = '')
{
// $foo = $p->friends_timeline();
$shop_oper = $this->SynchroOperator->find('first', array('conditions' => array('SynchroOperator.status' => 1)));
$app_key = $shop_oper['SynchroOperator']['app_key'];
$app_secret = $shop_oper['SynchroOperator']['app_secret'];
$access_token = $shop_oper['SynchroOperator']['access_token'];
$SaeTOAuthV2 = new SaeTOAuthV2($app_key, $app_secret, $access_token);
$url = 'statuses/friends_timeline';
$usparm['count'] = 50;
$usparm['page'] = 1;
$foo = $SaeTOAuthV2->get($url, $usparm);
if (empty($foo) || isset($foo['error_code'])) {
return false;
}
$friends_gp = array();
if (isset($foo['statuses'])) {
foreach ($foo['statuses'] as $k => $v) {
$friends_gp[] = $v['user']['name'];
}
}
return $friends_gp;
}
示例2: array
// Callback from Sina.
if (isset($_REQUEST['code'])) {
// 已经从Sina 获取的access token, 我们就从session 获取
if (isset($_SESSION["token"])) {
$token = json_decode($_SESSION["token"], TRUE);
$tmpUser = json_decode($_SESSION["yii_sina_tmpuser"], TRUE);
} else {
$keys = array();
$keys['code'] = $_REQUEST['code'];
$keys['redirect_uri'] = WB_CALLBACK_URL;
try {
$token = $o->getAccessToken('code', $keys);
$_SESSION["token"] = json_encode($token);
//POST token to Yii framework
$token["r"] = "user/sinacallback";
$ret = $o->get("http://" . $callback_parse["host"], $token);
if (!$ret["error"]) {
ob_clean();
$tmpUser = $ret["data"];
$_SESSION["yii_sina_tmpuser"] = json_encode($tmpUser);
} else {
// Error happend, todo
$tmpUser = NULL;
$error = $ret["error"]["message"];
}
} catch (OAuthException $e) {
// Error
$error = $e->getMessage();
}
}
}