nbsp; echo "Wrong!<br/>"; } break; case ''3'': // 调用 api user.getInfo,显示用户的姓名、uid和头像 // 发起API调用请求 $access_token =
PHP实现人人OAuth登录和API调用 _网学
浏览:
SESSION[''atoken'']; $params = array("method"=>"users.getInfo","v"=>"1.0", "access_token"=>$access_token,"format"=>"json"); $params[''sig''] = gensig($params,$SecretKey); $url = "http://api.renren.com/restserver.do"; $json = HttpClient::quickPost($url,$params); // 解析返回json $jsond = json_decode($json); $uid = $jsond[''0'']->uid; $tinyurl = $jsond[''0'']->tinyurl; $name = $jsond[''0'']->name; // 生成页面 echo "你好$name, 你的UID是$uid<br/>"; echo "<img src=\"$tinyurl\">"; break; default: break; } ?> 原文链接:http://www.cnblogs.com/tt-0411/archive/2012/05/30/2526459.html