技术教程
当前位置:首页 > 技术教程

获取QQ昵称和头像PHP源码

( 更新:09-01   加入收藏)

<?php
header("Access-Control-Allow-Origin:*");
header('Content-type: application/json');
$id = $_GET['qq'];
$get_info = file_get_contents('https://api.unipay.qq.com/v1/r/1450000186/wechat_query?cmd=1&pf=mds_storeopen_qb-__mds_qqclub_tab_-html5&pfkey=pfkey&from_h5=1&from_https=1&openid=openid&openkey=openkey&session_id=hy_gameid&session_type=st_dummy&qq_appid=&offerId=1450000186&sandbox=&provide_uin=' . $id);
$names = json_decode($get_info, true);
if(!isset($names['nick'])) return false;
$name = urldecode($names['nick']);
$txurl = 'https://q2.qlogo.cn/headimg_dl?dst_uin='.$id.'&spec=100';
$info = array('code' => '200','qq' => $id,'imgurl' =>$txurl,'name' => $name,);
echo json_encode($info,320);
?>

相关阅读