QQ群免 IDKEY 加群API源码
1 min read
网上的源码大都失效 经 @Timi.杨
提醒吾爱一位老哥的源码 2018最新根据群号得到idkey以及加群链接 还可以用
所以简单修改了一下改成了API接口
使用示例
- API服务:https://tenapi.cn/v2/group?qun=679849986&format=json
- 文档地址:https://docs.tenapi.cn/tencent/group.html
返回数据
{
"code": 200,
"data": {
"gid": 679849986,
"idkey": "a5cef71d9834cdf84e87850ead503d4bf91a7405e6ac6518bcc0e622bfb85669",
"url": "http://wp.qq.com/wpa/qunwpa?idkey=a5cef71d9834cdf84e87850ead503d4bf91a7405e6ac6518bcc0e622bfb85669"
}
}
PHP源码
<?php
$qqun = $_GET['qun'];
$type = $_GET['type'];
$t = time() * 1000;
if ($qqun == '') {
echo "参数不能为空";
}
if ($qqun != null) {
$url = "http://wp.qq.com/wpa/g_wpa_get?guin=" . $qqun . "&t=" . $t;
$arr = json_decode($url, true);
$ResArray = json_decode(file_get_content($url, 'get'), true);
$uid = $ResArray['result']['data'][0]['guin'];
$idkey = $ResArray['result']['data'][0]['key'];
if ($type == 301) {
$cs = 'http://wp.qq.com/wpa/qunwpa?idkey=' . $idkey . '';
header("Location:{$cs}");
}
$Json = array("code" => 200, "data" => array("uid" => $uid, "idkey" => $idkey, "url" => 'http://wp.qq.com/wpa/qunwpa?idkey=' . $idkey . ''));
$Json = json_encode($Json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
echo stripslashes($Json);
return $Json;
}