记录学习与后端知识并分享学习代码过程(会飞的鱼Blog)

PHP官方API提供ck获取对方Q等级接口源码

会飞的鱼 0 1542 2022年10月4日

提供ck可以免密查对方Q等级 只写了查等级 别的资料 你们需要写上或找我加上 分享分享思路。。。

<?php
/**
 * 提供ck获取对方Q等级
 * @author 晓超云博客
 * @link https://blog.kit9.cn/
 * @time 2022年01月01日
 */
header("content-type:application/json; charset=utf-8");
$uin=$_GET["uin"];//提供ck
$skey=$_GET["skey"];//提供ck
$p_skey=$_GET["p_skey"];//提供vip.qq.com ck
$qq=$_GET["qq"];//被查询qq

$url = 'https://h5.vip.qq.com/p/mc/cardv2/other?qq='.$qq;
$Cookie = 'p_uin=o'.$uin.'; uin=o'.$uin.'; skey='.$skey.'; p_skey='.$p_skey;
$data = teacher_curl($url,[
    'cookie'=>$Cookie,
]);
preg_match('/<p><small>LV<\/small>(.*?)<\/p>/',$data,$level); 

$json = json_decode($level[1],true);

print_r($json);

function teacher_curl($url, $paras = array()){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        if (@$paras['Header']) {
            $Header = $paras['Header'];
        } else {
            $Header[] = "Accept:*/*";
            $Header[] = "Accept-Encoding:gzip,deflate,sdch";
            $Header[] = "Accept-Language:zh-CN,zh;q=0.8";
            $Header[] = "Connection:close";
        }
        curl_setopt($ch, CURLOPT_HTTPHEADER, $Header);
        if (@$paras['ctime']) { // 连接超时
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $paras['ctime']);
        } else {
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
        }
        if (@$paras['rtime']) { // 读取超时
            curl_setopt($ch, CURLOPT_TIMEOUT, $paras['rtime']);
        }
        if (@$paras['post']) {
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $paras['post']);
        }
        if (@$paras['header']) {
            curl_setopt($ch, CURLOPT_HEADER, true);
        }
        if (@$paras['cookie']) {
            curl_setopt($ch, CURLOPT_COOKIE, $paras['cookie']);
        }
        if (@$paras['refer']) {
            if ($paras['refer'] == 1) {
                curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f=');
            } else {
                curl_setopt($ch, CURLOPT_REFERER, $paras['refer']);
            }
        }
        if (@$paras['ua']) {
            curl_setopt($ch, CURLOPT_USERAGENT, $paras['ua']);
        } else {
            curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36");
        }
        if (@$paras['nobody']) {
            curl_setopt($ch, CURLOPT_NOBODY, 1);
        }
        curl_setopt($ch, CURLOPT_ENCODING, "gzip");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        if (@$paras['GetCookie']) {
            curl_setopt($ch, CURLOPT_HEADER, 1);
            $result = curl_exec($ch);
            preg_match_all("/Set-Cookie: (.*?);/m", $result, $matches);
            $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
            $header = substr($result, 0, $headerSize); //状态码
            $body = substr($result, $headerSize);
            $ret = [
                "Cookie" => $matches, "body" => $body, "header" => $header, 'code' => curl_getinfo($ch, CURLINFO_HTTP_CODE)
            ];
            curl_close($ch);
            return $ret;
        }
        $ret = curl_exec($ch);
        if (@$paras['loadurl']) {
            $Headers = curl_getinfo($ch);
            $ret = $Headers['redirect_url'];
        }
        curl_close($ch);
        return $ret;
}
本文由 @会飞的鱼 于 2022-10-4 发布在 会飞的鱼Blog,如无特别说明,本博文章均为原创,转载请保留出处。

网友评论

    暂无评论

会飞的鱼 在线咨询

在线时间:9:00-22:00
周六、周日:14:00-22:00