首页 代码源码 正文 收录检测中~

PHPQQ_cookie存活期检测接口源码

可以用于检测QQ_COOKIE 是否失效 接口来源地址QQ业务开通

<?php
/**
 * QQ_COOKIE存活期检测
 * @author 晓超云博客
 * @link https://blog.kit9.cn/
 * @time 2022年11月03日
 */
$qq='123456';//填写qq号
$skey='123456';//填写skey @带不带看你什么地方取得 安卓和网页都可以 

$url = 'http://api.unipay.qq.com/v1/r/1450000172/wechat_query?cmd=7&session_id=uin&session_type=skey&openid='.$qq.'&openkey='.$skey;
$Cookie = 'p_uin=o'.$qq.'; uin=o'.$qq.'; skey='.$skey;
$header = ['User-Agent: Mozilla/5.0 (Linux; Android 10; HLK-AL00 Build/HONORHLK-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 Safari/537.36 V1_AND_SQ_8.4.5_1468_YYB_D QQ/8.4.5.4745 NetType/4G WebP/0.4.1 Pixel/1080 StatusBarHeight/51 SimpleUISwitch/0 QQTheme/1000 InMagicWin/0'];
$data = teacher_curl($url,[
    'cookie'=>$Cookie,
    'Header'=>$header
]);
$json=json_decode($data,true);

if ($json['ret'] == 0) {
die (json_encode(['code' => 200, 'msg' => 'success', 'result'=> 'COOKIE正常'],320));
} else if ($json['ret'] == 1018) {
die (json_encode(['code' => 201, 'msg' => 'failure', 'COOKIE已失效'],320));
}

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;
}

COOKIEQQ_COOKIE

上一篇
QQ小世界发布删除作品API
下一篇
QQ官方注册时间API

评论(4条)

  1. avatar

    麻瓜 Lv.1 Chrome 125.0.0.0 Chrome 125.0.0.0 Mac OS X 10.15.7 Mac OS X 10.15.7 回复

    这和获取qq业务的接口一样啊。

    #地板 湖北省咸宁市 移动

    1. avatar

      相濡以沫 Lv.1 Chrome 110.0.0.0 Chrome 110.0.0.0 Android 11 Android 11 回复

      博主能自动刷新吗,或者怎么获取cookie

      #板凳 江西省宜春市 电信

      1. avatar

        666 Lv.1 IBrowse r IBrowse r Android 11 Android 11 回复

        有没有QQ日签打卡的源码啊

        #沙发 山东省日照市 联通

        1. 晓超云博客 Chrome 107.0.0.0 Chrome 107.0.0.0 Windows Windows 回复

          回复了666:有

          陕西省西安市 移动