QQ昵称头像
根据QQ获取到QQ昵称和QQ头像

接口地址: http://125.64.3.73:6688/api/qqnc

返回格式: JSON

请求方式: GET

请求示例: http://125.64.3.73:6688/api/qqnc?qq=123456 | /api/qqnc?qq=123456&type=image

请求参数说明:

名称 必填 类型 说明
type string type=image时,返回头像,否则返回json数据

返回参数说明:

名称 类型 说明

返回示例:

{
    "code": 200, 
    "ip": "58.62.3.154", 
    "qq": 123456, 
    "name": "腾讯视频", 
    "qqimg": "https://q1.qlogo.cn/g?b=qq&nk=123456&s=100", 
    "title": "官网:http://dw.wchulian.com.cn/"
}
或者

请求参数设置:

参数名称 参数值


{
    "code": 200, 
    "ip": "58.62.3.154", 
    "qq": 123456, 
    "name": "腾讯视频", 
    "qqimg": "https://q1.qlogo.cn/g?b=qq&nk=123456&s=100", 
    "title": "官网:http://dw.wchulian.com.cn/"
}
或者

错误码格式说明:

名称 类型 说明

代码示例:

<?php
$qq = $_GET['qq'];
$api = 'http://125.64.3.73:6688/api/qqnc?qq='.$qq ;
$url = XingJi($api);
$arr= json_decode($url,true);
if ($arr['code']==204) {
header("Content-Type:text/html;charset=UTF-8");
echo $arr['msg'];
} else {
header("Content-Type: image/png");
echo $url;
}

function XingJi($url)
{
$ch = curl_init();
$timeout = 30;
$ua= $_SERVER['HTTP_USER_AGENT'];
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
$urls = $http_type . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER,$urls);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:'.$ip, 'CLIENT-IP:'.$ip));
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
?>