1. 承認されたログイン
http://openapi.qzone.qq.com/oauth/show?this=confirmPage&display=pc&response_type=code&client_id=101223150&redirect_uri=http://t.zy62.com/qqlogin .php
コードを取得
2. access_token を取得します
https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&client_id=101223150&redirect_uri=http://t.zy62.com/qqlogin.php&client_secret='独自のものに変更'&code=7A94789A36833731F7DED5C170BDA4FC
戻り結果:
access_token=72103010DD08905F8B171E4EF378B5CC&expires_in=7776000&refresh_token=53303C0A75719EED9E3CDF01C3476955
https://graph.qq.com/oauth2.0/me?access_token=72103010DD08905F8B171E4EF378B5CC
戻り結果: 標準 jsonp 形式
callback( {"client_id":" 101223150", "openid":"9ECFD84190F7D5D40E013CF84D0979FF"} );
{ "ret": 0、"msg": ""、"is_lost":0、"nickname": "yi."、"gender": "女性" 、"省": "湖北"、"市": "武漢"、"年": "1994"、"figureurl": "http://qzapp.qlogo.cn/qzapp/101223150/9ECFD84190F7D5D40E013CF84D0979FF/30 "," Figureurl_1": "http://qzapp.qlogo.cn/qzapp/101223150/9ECFD84190F7D5D40E013CF84D0979FF/50"、"figureurl_2": "http://qzapp.qlogo.cn/qzapp/101223150/9ECFD84190F7D5D40E01 3CF84D0979FF/100","figureurl_qq_1 ": "http://q.qlogo.cn/qqapp/101223150/9ECFD84190F7D5D40E013CF84D0979FF/40"、"figureurl_qq_2": "http://q.qlogo.cn/qqapp/101223150/9ECFD84190F7D5D40E01 0979FF/100"、"is_ yellow_vip " : "0"、"vip": "0"、" yellow_vip_level": "0"、 "level": "0"、 "is_ yellow_year_vip": "0" }
<?php//print_r($_GET);//exit('qqlogin');//1.获取code$code=$_GET['code'];//2.获取access_token$url='https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&client_id=101223150&redirect_uri=http://t.zy62.com/qqlogin.php&client_secret='换成你自己的'&code='.$code;$rs=file_get_contents($url);$arr=explode('&',$rs);//print_r($arr);//3获取openid$url='https://graph.qq.com/oauth2.0/me?'.$arr[0];$rs=file_get_contents($url);echo $rs;