bsp;
PHP实现人人OAuth登录和API调用 _网学
浏览:
SESSION[''atoken''] = ''''; $url = "http://graph.renren.com/oauth/authorize?client_id=$APIKey". "&response_type=code&scope=$scope&redirect_uri=$redirecturi"; echo "<a href=\"$url\">使用人人帐号登录</a><br/>"; break; case ''2'': // 获取 access token,给出api调用的连接 // 获取 request token,即code $code =
PHP实现人人OAuth登录和API调用 _网学
浏览:
REQUEST[''code'']; // 发起获取 access token请求 $url = "http://graph.renren.com/oauth/token?client_id=$APIKey&code=$code". "&grant_type=authorization_code&client_secret=$SecretKey&redirect_uri=$redirecturi"; $json = HttpClient::quickGet($url); // 解析返回 json $jsond = json_decode($json); $access_token = $jsond->access_token; // 生成页面 if(!emptyempty($access_token)){
PHP实现人人OAuth登录和API调用 _网学
浏览:
SESSION[''atoken''] = $access_token; $url = $redirecturi."?magic=3"; echo "access token: $access_token<br/>"; echo "<a href=\"$url\">调用API: users.getInfo</a>"; }else{ &