接口说明
本接口来源于官方
源码分享
<?php
function get_qq_nick($qqCode) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://users.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?uins=' . $qqCode);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_POSTFIELDS, '------WebKitFormBoundaryYTwvlk5brGmyD3Mn');
curl_setopt($curl, CURLOPT_HTTPHEADER, [
'Content-Type: multipart/form-data; boundary=---011000010111000001101001',
]);
$response = curl_exec($curl);
$encode = mb_detect_encoding($response, array("ASCII", 'UTF-8', "GB2312", "GBK", 'BIG5'));
$response = mb_convert_encoding($response, 'UTF-8', $encode);
$name = json_decode(substr($response, 17, -1), true);
curl_close($curl);
return $name[$qqCode][6];
}
echo get_qq_nick('3074193836');
?>
注意事项
如果上传了没法使用 请检查服务器环境
1.是否为国内服务器(不是必须)
2.PHP环境是否为7-8
3.服务器是否正确安装环境
这个很实用