获取QQ头像及昵称
API获取QQ昵称和头像

接口地址: https://api.svipk.com/api/qqt/

返回格式: JSON

请求方式: GET/POST

请求示例: https://api.svipk.com/api/qqt/?apiKey=后台获取的秘钥&qq=1984972795

请求参数说明:

名称 必填 类型 说明
qq string 需要获取的QQ号码

返回参数说明:

名称 类型 说明
imgurl string QQ头像地址
name string QQ昵称
code string 状态码

返回示例:

{
"code":1
"imgurl":"https://q1.qlogo.cn/headimg_dl?dst_uin=1984972795&spec=100"
"name":"超级江湖人"
}

错误码格式说明:

名称 类型 说明
-1 code 系统错误

代码示例:

昵称演示:
<?php
header("Content-Type:text/html;charset=UTF-8");
date_default_timezone_set("PRC");
$qq = "1984972795";
$result = file_get_contents("https://www.jianghu.cool/api/img/?apiKey=后台获取的秘钥&qq=".$qq);
$arr=json_decode($result,true);
if ($arr['code']==1) {
echo "QQ昵称:".$arr['name'];
} else {
echo $arr['msg'];
}
?>


头像演示:
<?php
header("Content-Type:text/html;charset=UTF-8");
date_default_timezone_set("PRC");
$qq = "1984972795";
$result = file_get_contents("https://www.jianghu.cool/api/img/?apiKey=后台获取的秘钥&qq=".$qq);
$arr=json_decode($result,true);
if ($arr['code']==1) {
header('Content-type: image/png');
$res = imagecreatefromstring(file_get_contents($arr['imgurl']));
imagepng($res);
imagedestroy($res);
} else {
echo $arr['msg'];
}
?>