虎泰克博客

11月9日更新内容


接入人人网登录,代码如下 <?php session_start(); $code =

接入人人网登录,代码如下 <?php session_start(); $code = $_GET["code"]; $username = get_info($code); ?> <?php function get_info($code){ $url="https://graph.renren.com/oauth/token?grant_type=authorization_code&client_id=app id&redirect_uri=http://www.suifengpiaoyang.cn/api/renloginback.php&client_secret=client_secret&code=$code";//curl获取access token 链接 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $info = curl_exec($ch);//获取人人服务器返回信息 curl_close($ch); $userinfo = json_decode("$info", true); $name = "rr_".$userinfo["user"]["name"]; //获取用户名 return $name;//返回用户名 } ?>


Statement: all articles / drawings reproduced on this website are for the purpose of transmitting more information and facilitating discussion, which does not mean that the website, the host and the organizer agree with their opinions or confirm the authenticity of their contents. The contents of the articles are for reference only. If the rights of the original author are violated, please contact the website administrator.

Sign in to comment

Comment list

    No data