백엔드 개발 PHP 튜토리얼 php使用curl抓取qq空间的访客信息示例_PHP教程

php使用curl抓取qq空间的访客信息示例_PHP教程

Jul 13, 2016 am 10:36 AM
curl php qq 방문객

config.php

复制代码 代码如下:

define('APP_DIR', dirname(__FILE__));
define('COOKIE_FILE', APP_DIR . '/app.cookie.txt'); //会话记录文件
define('VISITOR_CAPTURE_INTERVAL', 3); //QQ采集间隔
define('VISITOR_DATA_UPLOAD_INTERVAL', '');
define('THIS_TIME', time());

define('REQUEST_TIMEOUT', 20); //请求超时20秒
define('END_LINE', "\n");
define('DEBUG', true); //开启调试

$login_users = array(
    array('user' => '2064556526', 'password' => '909124951'),
    array('user' => '483258700', 'password' => '909124951'),
    array('user' => '1990270522', 'password' => '909124951'),
    array('user' => '2718711637', 'password' => '909124951'),
    array('user' => '2841076562', 'password' => '909124951'),
);

qy.visitor.php

复制代码 代码如下:

include('./config.php');
include(APP_DIR . '/qy.visitor.php');

$sessions = array();
$user = $login_users[array_rand($login_users)];

$visitor_capture = new QQVisitorCapture($user['user'], $user['password'], COOKIE_FILE, REQUEST_TIMEOUT, DEBUG, END_LINE);

$visitors = $visitor_capture->getVisitorInfo();

if (empty($visitors)) {
    $this->clearCookies(true);
} else {
    $cckf_service = new CCKFService(SECURITY_KEY,SERVICE_ID,SERVICE_ADDRESS,'', REQUEST_TIMEOUT, DEBUG, END_LINE);
}

qy.class.php

复制代码 代码如下:


class Trace
{
    public static function nl($num = 1)
    {
        $str = '';
        for ($i = 0; $i             $str .= "\n";
        }
        return $str;
    }

    public static function br($num = 1)
    {
        $str = '';
        for ($i = 0; $i             $str .= "
";
        }
        return $str;
    }

    public static function write($content, $end_line, $title = null)
    {
        $close = '^^^^^^^^^^^^^^^^^';

        if ($title) {
            $start = '--------' . $title . '---------';
        } else {
            $start = '-----------------';
        }

        echo $start . $end_line;

        if (is_array($content)) {
            print_r($content);
            echo $end_line;
        } else {
            echo $content;
            echo $end_line;
        }

        if (empty($content)) {
            echo $end_line;
        } else {
            echo $close . $end_line;
        }
    }

}


class Utils
{

    public static function getMicroTime()
    {
        list($mic, $time) = explode(" ", microtime());
        return intval($time) + floatval(sprintf('%.3f', $mic));
    }

    public static function getUTCMilliseconds()
    {
        return round(rand(1, 9) / 10 * 2147483647) * round(1, 999) % 10000000000;
    }

    public static function decodeURIComponent($content)
    {
        return urldecode(preg_replace("/\\\\x([0-9a-z]{2,3})/i", "%$1", $content));
    }

    public static function  jsRandom()
    {
        list($mic, $time) = explode(" ", microtime());
        return $mic;
    }

    function loginJsTime()
    {
        list($mic, $time) = explode(" ", microtime());
        return $time . sprintf('%3d', $mic * 1000);

    }

    protected static function utf8_unicode($c)
    {
        switch (strlen($c)) {
            case 1:
                return ord($c);
            case 2:
                $n = (ord($c[0]) & 0x3f)                 $n += ord($c[1]) & 0x3f;
                return $n;
            case 3:
                $n = (ord($c[0]) & 0x1f)                 $n += (ord($c[1]) & 0x3f)                 $n += ord($c[2]) & 0x3f;
                return $n;
            case 4:
                $n = (ord($c[0]) & 0x0f)                 $n += (ord($c[1]) & 0x3f)                 $n += (ord($c[2]) & 0x3f)                 $n += ord($c[3]) & 0x3f;
                return $n;
        }
    }

    public static function  getGTK($str)
    {
        $hash = 5381;
        for ($i = 0, $len = strlen($str); $i             $hash += ($hash         }
        return $hash & 2147483647;
    }

    protected static function hexchar2bin($str)
    {
        $arr = '';
        $temp = null;
        for ($i = 0; $i             $arr .= "\\x" . substr($str, $i, 2);
        }
        eval('$temp="' . $arr . '";');
        return $temp;
    }

    protected static function getUid($uid)
    {
        $temp = null;
        eval('$temp="' . $uid . '";');
        return $temp;
    }

    public static function getEncryption($password, $uin, $vcode)
    {
        $uin = self::getUid($uin);
        $str1 = self::hexchar2bin(strtoupper(md5($password)));
        $str2 = strtoupper(md5($str1 . $uin));
        return strtoupper(md5($str2 . strtoupper($vcode)));
    }

}

class CookieFileExtract
{
    protected $cookie_file;
    protected $cookie_list;

    protected function  __construct($cookie_file)
    {
        $this->cookie_file = $cookie_file;

        $this->cookie_list = $this->extractFile();
    }

    protected function isValidateCookieFile()
    {
        if ($this->cookie_file && file_exists($this->cookie_file)) {
            return true;
        } else {
            return false;
        }
    }

    protected function extractFile()
    {
        $cookie_list = array();

        if ($this->isValidateCookieFile($this->cookie_file)) {
            $content = file($this->cookie_file);
            if (is_array($content)) {
                foreach ($content as $line) {
                    $line = trim($line);
                    if (strlen($line) > 0 && $line[0] != '#') {
                        $cookie = (preg_split("/\s+/", $line));
                        if (count($cookie) == 7) {
                            $cookie_list[$cookie[5]] = $cookie[6];
                        } else {
                            $cookie_list[$cookie[5]] = '';
                        }
                    }
                }
            }
        }

        return $cookie_list;
    }

    protected function buildCookieStr($cookies)
    {
        $arr = array();

        if (is_array($cookies)) {
            foreach ($cookies as $k => $cookie) {
                $line = $cookie['domain'] . "\t" . "TRUE" . "\t" . $cookie['path'] . "\t" . "FALSE" . "\t" . $cookie['expires'] . "\t" . $k . "\t" . $cookie['value'];
                $arr[] = $line;
            }
        }
        return $arr;
    }

    protected function __setCookies($cookies)
    {
        $new_line = array();
        if (is_array($cookies)) {
            if ($this->isValidateCookieFile($this->cookie_file)) {
                $content = file($this->cookie_file);
                if (is_array($content)) {
                    foreach ($content as $line) {
                        $line = trim($line);
                        if (strlen($line) > 0 && $line[0] != '#') {
                            $cookie = (preg_split("/\s+/", $line));
                            if (!in_array($cookie[5], $cookies)) {
                                $new_line[] = $line;
                            }
                        } else {
                            $new_line[] = $line;
                        }
                    }
                }
            }

            file_put_contents($this->cookie_file, implode("\n", array_merge($new_line, $this->buildCookieStr($cookies))));
        }
    }

    protected function __getAllCookies($refresh = false)
    {
        if ($refresh) {
            $this->cookie_list = $this->extractFile();
        }
        return $this->cookie_list;
    }

    protected function __getCookie($cookie_name, $refresh = false)
    {
        $cookie_list = $this->__getAllCookies($refresh);

        if (is_array($cookie_list) && array_key_exists($cookie_name, $cookie_list)) {
            return $cookie_list[$cookie_name];
        } else {
            return null;
        }
    }

    protected function __clearAllCookies()
    {
        $this->cookie_list = null;
        @unlink($this->cookie_file);
    }
}

class BaseRequest extends CookieFileExtract
{

    protected $curl_instance;
    protected $request_timeout;
    protected $debug;
    protected $end_line;
    protected $user_agent = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:26.0) Gecko/20100101 Firefox/26.0';

    protected function __construct($cookie_file, $request_timeout, $debug, $end_line)
    {
        parent::__construct($cookie_file);
        $this->request_timeout = $request_timeout;
        $this->debug = $debug;
        $this->end_line = $end_line;
        $this->initInstance();
    }

    protected function initInstance()
    {

        $this->curl_instance = curl_init();

        if ($this->isValidateCookieFile()) {
            curl_setopt($this->curl_instance, CURLOPT_COOKIEJAR, $this->cookie_file);
            curl_setopt($this->curl_instance, CURLOPT_COOKIEFILE, $this->cookie_file);
        }

        curl_setopt($this->curl_instance, CURLOPT_TIMEOUT, $this->request_timeout);
        curl_setopt($this->curl_instance, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($this->curl_instance, CURLOPT_HEADER, 1);
        curl_setopt($this->curl_instance, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($this->curl_instance, CURLOPT_SSL_VERIFYHOST, 0);
        curl_exec($this->curl_instance);

    }

    function setCookies($cookies)
    {
        $this->closeInstance();
        $this->__setCookies($cookies);
        $this->initInstance();
    }

    protected function getAllCookies($refresh = false)
    {
        $this->closeInstance();
        $cookies = $this->__getAllCookies($refresh);
        $this->initInstance();
        return $cookies;
    }


    protected function clearAllCookies($refresh = false)
    {
        $this->closeInstance();
        $this->__clearAllCookies();

        if ($refresh) {
            $this->initInstance();
        }
    }

    protected function getCookie($name, $refresh = false)
    {
        $this->closeInstance();
        $cookie = $this->__getCookie($name, $refresh);
        $this->initInstance();
        return $cookie;
    }

    protected function getRequestInstance()
    {
        return $this->curl_instance;
    }

    protected function closeInstance()
    {
        if (is_resource($this->curl_instance)) {
            curl_close($this->curl_instance);
        }
    }

    protected function resetInstance()
    {
        $this->closeInstance();
        @unlink($this->cookie_file);
        $this->initInstance();
    }

    protected function requestExec($option)
    {

        curl_setopt_array($this->getRequestInstance(), $option);

        //if ($this->debug) {
        //    $result = curl_exec($this->getRequestInstance());
        //    Trace::write($result, $this->end_line, 'request output');
        //} else {
        return curl_exec($this->getRequestInstance());
        //}
    }
}

class QQVisitorRequest extends BaseRequest
{
    protected $user;
    protected $password;

    protected function __construct($user, $password, $cookie_file, $request_timeout, $debug, $end_line)
    {

        parent::__construct(dirname($cookie_file) . '/' . $user . '.' . basename($cookie_file), $request_timeout, $debug, $end_line);
        $this->user = $user;
        $this->password = $password;
    }
}


class ResultExtract
{

    public static function  getCoreJsInfo($content, $user)
    {
        $arr = array();
        preg_match('/cfg\s*=\s*\{(.*?)\s*\}\s*,\s*URL_PARAM_HASH/s', $content, $m);
        if (count($m) > 0) {
            $f = preg_replace('/\s*/', '', $m[1]);
            $f = preg_replace('/"\+g\_iLoginUin\+"/', $user, $f);
            $f = preg_replace('/\$j\.cookie.get\("hotfeeds_closed"\)==1\?""\:/', '', $f);

            $f = explode(",", $f);
            if (count($f) > 0) {
                foreach ($f as $t) {
                    $t = trim($t);
                    $p = strpos($t, ':');
                    $key = trim(substr($t, 0, $p), '"');
                    $value = trim(substr($t, $p + 1), '"');
                    if ($key) {
                        $arr[$key] = $value;
                    }
                }

                if (count($arr) > 0) {
                    $arr['visitor'] = $arr;
                }
            }
        }

        return $arr;
    }

    public static function  enterQzoneSuccess($content)
    {
        $arr = array();
        $arr2 = array();
        preg_match('/g_Data\s*=\s*{\s*feedsPart1\s*:\s*(.*?)\s*,\s*feedsPart2/s', $content, $m);

        if (count($m) > 0) {
            $f = preg_replace('/\s*/', '', $m[1]);
            $f = preg_replace('/([\{,])([^,]*?)(\:)/', '$1"$2"$3', $f);
            $f = preg_replace('/:\'(.*?)\'([,\}])/', ':"$1"$2', $f);
            $arr = json_decode($f, true);
            $arr = $arr['main'];
        }

        preg_match('/g_type.*?g_IZone_Flag/s', $content, $m);

        if (count($m) > 0) {
            $f = preg_replace('/\s*/', '', $m[0]);
            $f = explode(",", $f);

            foreach ($f as $t) {
                $t = trim($t);
                $p = strpos($t, '=');
                $key = trim(substr($t, 0, $p));
                $value = trim(substr($t, $p + 1), '"');
                if ($key) {
                    $arr2[$key] = $value;
                }
            }
        }

        return array_merge($arr, $arr2);

    }

    public static function getLoginJsInfo($content)
    {

        $s = preg_replace('/.*?pt\.plogin\s*=\s*\{(.*?)aqScanLink.*/s', '$1', $content);
        preg_match('/.*js_type\s*:\s*(\d+)\s*,.*/', $s, $m);

        if (count($m) > 1) {
            return array('js_type' => $m[1]);
        }

        return array();
    }

    public static function getLoginAddress($content)
    {
        preg_match('/.*?\s*.*?/', $content, $m);

        if (count($m) > 1) {
            return html_entity_decode($m[1]);
        }
        return null;
    }

    public static function checkLoginSuccess($content)
    {

        preg_match_all('/.*?\((.*)\).*?/', $content, $match);
        if ($match[1][0]) {
            $g = explode(',', $match[1][0]);
            if (count($g) > 1) {
                if (($g[count($g) - 2]) == "'登录成功!'") {
                    $url_parts = parse_url($g[2]);
                    parse_str($url_parts['query'], $arr);
                    if (array_key_exists('ptsig', $arr)) {
                        $ptsig = $arr['ptsig'];
                    } else {
                        $ptsig = null;
                    }
                    return array('status' => true, 'value' => array('url' => $g[2], 'ptsig' => $ptsig));
                }
            }
        }
        return array('status' => false);
    }


    public static function rightFrameVisitors($content)
    {
        $visitor_list = array();
        $f = preg_replace('/\s*/', '', $content);
        $f = preg_replace('/.*?_Callback\((\{.*?\})\).*?/', '$1', $f);
        $f = json_decode($f, true);

        if (is_array($f) && count($f) > 0 && array_key_exists('data', $f)
            && array_key_exists('module_3', $f['data'])
            && array_key_exists('data', $f['data']['module_3'])
            && array_key_exists('items', $f['data']['module_3']['data'])
        ) {

            $visitors = $f['data']['module_3']['data']['items'];

            foreach ($visitors as $visitor) {

                if (!array_key_exists('loc', $visitor)) {
                    $visitor_list [] = array(
                        'uin' => $visitor['uin'], 'name' => $visitor['name'], 'online' => $visitor['online'], 'time' => $visitor['time'],
                        'img' => $visitor['img'], 'yellow' => $visitor['yellow'], 'supervip' => $visitor['supervip'],
                    );
                }
            }
        }

        return $visitor_list;
    }

    public static function getVisitors($content)
    {

        $f = preg_replace('/\s*/', '', $content);
        preg_match('/^.*?(\{.*?\})\);\s*$/', $f, $m);

        $visitor_list = array();

        if (is_array($m) && count($m) > 1 && strlen($m[1]) > 0) {
            $visitors = json_decode(trim($m[1]), true);

            if (array_key_exists('data', $visitors) && array_key_exists('items', $visitors['data'])) {

                foreach ($visitors['data']['items'] as $visitor) {

                    if ($visitor['name']) {
                        $_ = array(
                            'uin' => $visitor['uin'], 'name' => $visitor['name'], 'time' => $visitor['time'],
                            'yellow' => $visitor['yellow'], 'supervip' => $visitor['supervip'],
                        );
                        if (array_key_exists('portraitlabel', $visitor)) {
                            $_['portraitlabel'] = $visitor['portraitlabel'];
                        }
                        $visitor_list[] = $_;

                        if (array_key_exists('uins', $visitor)) {
                            foreach ($visitor['uins'] as $uins) {
                                $_ = array(
                                    'uin' => $uins['uin'], 'name' => $uins['name'], 'time' => $uins['time'],
                                    'yellow' => $uins['yellow'], 'supervip' => $uins['supervip'],
                                );

                                if (array_key_exists('portraitlabel', $uins)) {
                                    $_['portraitlabel'] = $uins['portraitlabel'];
                                }
                                $visitor_list[] = $_;
                            }
                        }
                    }
                }
            }
        }
        return $visitor_list;
    }

    public static function  checkVC($content)
    {
        preg_match_all('/.*?\((.*)\).*?/', $content, $match);

        if (strlen($match[1][0]) > 1) {
            $m = str_replace("'", '', $match[1][0]);
            $g = explode(',', $m);

            if (count($g) == 3) {
                return array('saltUin' => $g[2], 'verifycode' => $g[1], 'RSAKey' => $g[2] ? false : true);
            }
        }
        return array();
    }

    public static function getLoginInfo($content)
    {
        $s = preg_replace('/.*?pt\.ptui\s*=\s*\{(.*?)\}\s*;.*/s', '$1', $content);
        $e = preg_split('/,\s*/', trim($s));

        $info = array();

        foreach ($e as $t) {

            $t = trim($t);
            $p = strpos($t, ':');
            $key = trim(substr($t, 0, $p));
            $value = trim(substr($t, $p + 1));

            if (preg_match('/encodeURIComponent/', $value)) {
                $value = preg_replace('/^encodeURIComponent\s*\(\s*"(.*)?"\s*\)\s*,?$/', '$1', $value);
            } else {
                $value = trim($value, '",');
            }

            if ($key) {
                $info[$key] = urldecode($value);
            }
        }
        return $info;
    }

}


class QQVisitorCapture extends QQVisitorRequest
{

    public function __construct($user, $password, $cookie_file, $request_timeout, $debug, $end_line)
    {
        parent:: __construct($user, $password, $cookie_file, $request_timeout, $debug, $end_line);
    }

    public function trace($content, $title)
    {
        if ($this->debug = true) {
            Trace:: write($content, $this->end_line, $title);
        }
    }

    public function error($message)
    {
        $this->trace($message, 'login error ');
        return false;
    }

    public function success()
    {
        return true;
    }

    public function getGTKEncryption()
    {
        return Utils ::getGTK($this->getCookie('skey', true));
    }

    public function getCookies($refresh = false)
    {
        return $this->getAllCookies($refresh);
    }

    public function clearCookies($refresh = false)
    {
        return $this->clearAllCookies($refresh);
    }

    public function login()
    {
        $login_submit_info_url = null;
        $login_submit_info_url = $this->visitQzone();

        $this->setCookies(array(
            'pgv_pvid' => array(
                'value' => Utils::getUTCMilliseconds(), 'path' => '/', 'domain' => '.qq.com', 'expires' => '0'
            ),
            'pgv_info' => array(
                'value' => 'ssid=s' . Utils::getUTCMilliseconds(), 'path' => '/', 'domain' => '.qq.com', 'expires' => '0'
            ),
            '_qz_referrer' => array(
                'value' => 'qzone.qq.com', 'path' => '/', 'domain' => '.qq.com', 'expires' => '0'
            ),
        ));

        //log
        $this->trace('', 'login begin');

        //log
        $this->trace($login_submit_info_url, '$login_submit_info_url===');

        $login_submit_info = $this->getLoginSubmitInfo($login_submit_info_url);

        //log
        $this->trace($login_submit_info, '$login_submit_info===');

        if (empty($login_submit_info)) {
            $this->error('err-001');
        }

        $this->report();

        //log
        $this->trace('', 'getLoginJs');
        $js_arr = $this->getLoginJs();

        //log
        $this->trace($js_arr, '$getLoginJs===');

        if (empty($js_arr)) {
            $this->error('err-002');
        }

        $u = $uin = $this->user;
        $r = Utils::jsRandom();
        $verifycode = null;
        $pt_rsa = null;
        $ptredirect = $login_submit_info['target'];
        $h = $t = $g = $from_ui = 1;
        $p = null;
        $regmaster = $login_submit_info['regmaster'];
        $u1 = Utils::decodeURIComponent($login_submit_info['s_url']);
        $ptlang = $login_submit_info['lang'];
        $action = strval(rand(5, 9)) . '-' . strval(strlen($this->user) + strlen($this->password) + rand(1, 5)) . '-' . Utils::loginJsTime();
        $js_ver = $login_submit_info['ptui_version'];
        $js_type = $js_arr['js_type'];
        $login_sig = $login_submit_info['login_sig'];
        $appid = $aid = $login_submit_info['appid'];
        $pt_qzone_sig = $login_submit_info['pt_qzone_sig'];
        $daid = $login_submit_info['daid'];

        //log
        $this->trace('', 'checkVC');
        $check_data = $this->checkVC($regmaster, $appid, $js_ver, $js_type, $login_sig, $u1, $r);

        if (count($check_data) !== 3) {
            $this->error('err-003');
        }

        //log
        $this->trace($check_data, '$check_data===');

        //log
        $this->trace(json_encode($check_data), '$check_data===');

        $verifycode = $check_data['verifycode'];

        if ($check_data['RSAKey']) {
            $this->error('err-004');
        } else {
            $p = Utils::getEncryption($this->password, $check_data['saltUin'], $verifycode);
            $pt_rsa = 0;
        }

        //log
        $this->trace('', 'submitLogin');

        $this->setCookies(array(
            'ptui_loginuin' => array(
                'value' => $this->user, 'path' => '/', 'domain' => '.qq.com', 'expires' => '0'
            ),
        ));

        $login_result = $this->submitLogin($verifycode, $p,
            $pt_rsa, $ptredirect, $u1,
            $h, $t, $g, $from_ui,
            $ptlang, $action, $js_ver, $js_type,
            $login_sig, $aid, $daid, $pt_qzone_sig);

        if ($login_result['status']) {
            $this->trace('登录成功', 'submitLogin');
            $this->trace($login_result, '$login_result====');
            $this->loginSuccessRedirect($login_result['value']['url']);
            $this->setCookies(array(
                'fnc' => array(
                    'value' => 1, 'path' => '/', 'domain' => '.qzone.qq.com', 'expires' => '0'
                ),
            ));
            $enterQzoneInfo = $this->enterQzone($login_result['value']['url'], $login_result['value']['ptsig']);

            //log
            $this->trace($enterQzoneInfo, '$enterQzoneInfo===');

            if ($enterQzoneInfo) {

                $this->trace('进入空间', 'enterQzone');

                //$referer = $login_result['value']['url'];
                //$scope = 0;

                //log
                $this->trace('', 'getCoreJs');
                $coreJsInfo = $this->getCoreJs();
                $this->trace($coreJsInfo, 'getCoreJs===');

                $this->setCookies(array(
                    'qzone_referer' => array(
                        'value' => $login_result['value']['url'], 'path' => '/', 'domain' => '.local.cckf123456789.com', 'expires' => '0'
                    ),
                    'qzone_visitor_param' => array(
                        'value' => implode('|', array_values($coreJsInfo['visitor'])), 'path' => '/', 'domain' => '.local.cckf123456789.com', 'expires' => '0'
                    ),
                ));

                //log
                //$this->trace('', 'rightFrameVisitor');
                //print_r($this->rightFrameVisitor($referer, implode('|', array_values($coreJsInfo['visitor']))));

                return $this->success();
            } else {
                $this->error('err-006');
            }

        } else {
            $this->error('err-005');
        }
    }

    protected function visitQzone()
    {
        $options = array(
            CURLOPT_TIMEOUT => $this->request_timeout,
            CURLOPT_HEADER => 1,
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_URL => 'http://qzone.qq.com',
            CURLOPT_HTTPHEADER => array(
                'Referer:http://xui.ptlogin2.qq.com/cgi-bin/xlogin?proxy_url=http%3A//qzs.qq.com/qzone/v6/portal/proxy.html&daid=5&pt_qzone_sig=1&hide_title_bar=1&low_login=0&qlogin_auto_login=1&no_verifyimg=1&link_target=blank&appid=549000912&style=22&target=self&s_url=http%3A//qzs.qq.com/qzone/v5/loginsucc.html?para=izone&pt_qr_app=%E6%89%8B%E6%9C%BAQQ%E7%A9%BA%E9%97%B4&pt_qr_link=http%3A//z.qzone.com/download.html&self_regurl=http%3A//qzs.qq.com/qzone/v6/reg/index.html&pt_qr_help_link=http%3A//z.qzone.com/download.html',
                'User-Agent:' . $this->user_agent,
                'Host:qzone.qq.com',
                'Accept-Language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3',
                'Connection:keep-alive',)
        );

        return ResultExtract::getLoginAddress($this->requestExec($options));
    }

    protected function getLoginJs()
    {
        $options = array(
            CURLOPT_TIMEOUT => $this->request_timeout,
            CURLOPT_HEADER => 1,
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_URL => 'http://imgcache.qq.com/ptlogin/ver/10067/js/c_login_old.js',
            CURLOPT_HTTPHEADER => array(
                'Referer:http://xui.ptlogin2.qq.com/cgi-bin/xlogin?proxy_url=http%3A//qzs.qq.com/qzone/v6/portal/proxy.html&daid=5&pt_qzone_sig=1&hide_title_bar=1&low_login=0&qlogin_auto_login=1&no_verifyimg=1&link_target=blank&appid=549000912&style=22&target=self&s_url=http%3A//qzs.qq.com/qzone/v5/loginsucc.html?para=izone&pt_qr_app=%E6%89%8B%E6%9C%BAQQ%E7%A9%BA%E9%97%B4&pt_qr_link=http%3A//z.qzone.com/download.html&self_regurl=http%3A//qzs.qq.com/qzone/v6/reg/index.html&pt_qr_help_link=http%3A//z.qzone.com/download.html',
                'User-Agent:' . $this->user_agent,
                'Host:imgcache.qq.com',
                'Connection:keep-alive',)
        );

        return ResultExtract::getLoginJsInfo($this->requestExec($options));
    }

    public function checkVC($regmaster, $appid, $js_ver, $js_type, $login_sig, $u1, $r)
    {

        $options = array(
            CURLOPT_TIMEOUT => $this->request_timeout,
            CURLOPT_HEADER => 1,
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_URL => 'http://check.ptlogin2.qq.com/check?' . http_build_query(array(
                'regmaster' => $regmaster,
                'uin' => $this->user,
                'appid' => $appid,
                'js_ver' => $js_ver,
                'js_type' => $js_type,
                'login_sig' => $login_sig,
                'u1' => $u1,
                'r' => $r,
            )),
            CURLOPT_HTTPHEADER => array(
                'Referer:http://xui.ptlogin2.qq.com/cgi-bin/xlogin?proxy_url=http%3A//qzs.qq.com/qzone/v6/portal/proxy.html&daid=5&pt_qzone_sig=1&hide_title_bar=1&low_login=0&qlogin_auto_login=1&no_verifyimg=1&link_target=blank&appid=549000912&style=22&target=self&s_url=http%3A//qzs.qq.com/qzone/v5/loginsucc.html?para=izone&pt_qr_app=%E6%89%8B%E6%9C%BAQQ%E7%A9%BA%E9%97%B4&pt_qr_link=http%3A//z.qzone.com/download.html&self_regurl=http%3A//qzs.qq.com/qzone/v6/reg/index.html&pt_qr_help_link=http%3A//z.qzone.com/download.html',
                'User-Agent:' . $this->user_agent,
                'Host:check.ptlogin2.qq.com',
                'Accept-Language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3',
                'Connection:keep-alive',
            )
        );

        return ResultExtract::checkVC($this->requestExec($options));
    }

    protected function report()
    {
        $url = 'http://ui.ptlogin2.qq.com/cgi-bin/report?id=358342&t=' . Utils::jsRandom();

        $options = array(
            CURLOPT_TIMEOUT => $this->request_timeout,
            CURLOPT_HEADER => 1,
            CURLOPT_RETURNTRANSFER => 1,
    &

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

JWT (JSON Web Tokens) 및 PHP API의 사용 사례를 설명하십시오. JWT (JSON Web Tokens) 및 PHP API의 사용 사례를 설명하십시오. Apr 05, 2025 am 12:04 AM

JWT는 주로 신분증 인증 및 정보 교환을 위해 당사자간에 정보를 안전하게 전송하는 데 사용되는 JSON을 기반으로 한 개방형 표준입니다. 1. JWT는 헤더, 페이로드 및 서명의 세 부분으로 구성됩니다. 2. JWT의 작업 원칙에는 세 가지 단계가 포함됩니다. JWT 생성, JWT 확인 및 Parsing Payload. 3. PHP에서 인증에 JWT를 사용하면 JWT를 생성하고 확인할 수 있으며 사용자 역할 및 권한 정보가 고급 사용에 포함될 수 있습니다. 4. 일반적인 오류에는 서명 검증 실패, 토큰 만료 및 대형 페이로드가 포함됩니다. 디버깅 기술에는 디버깅 도구 및 로깅 사용이 포함됩니다. 5. 성능 최적화 및 모범 사례에는 적절한 시그니처 알고리즘 사용, 타당성 기간 설정 합리적,

PHP에서 늦은 정적 결합을 설명하십시오 (정적 : :). PHP에서 늦은 정적 결합을 설명하십시오 (정적 : :). Apr 03, 2025 am 12:04 AM

정적 바인딩 (정적 : :)는 PHP에서 늦은 정적 바인딩 (LSB)을 구현하여 클래스를 정의하는 대신 정적 컨텍스트에서 호출 클래스를 참조 할 수 있습니다. 1) 구문 분석 프로세스는 런타임에 수행됩니다. 2) 상속 관계에서 통화 클래스를 찾아보십시오. 3) 성능 오버 헤드를 가져올 수 있습니다.

php magic 방법 (__construct, __destruct, __call, __get, __set 등)이란 무엇이며 사용 사례를 제공합니까? php magic 방법 (__construct, __destruct, __call, __get, __set 등)이란 무엇이며 사용 사례를 제공합니까? Apr 03, 2025 am 12:03 AM

PHP의 마법 방법은 무엇입니까? PHP의 마법 방법은 다음과 같습니다. 1. \ _ \ _ Construct, 객체를 초기화하는 데 사용됩니다. 2. \ _ \ _ 파괴, 자원을 정리하는 데 사용됩니다. 3. \ _ \ _ 호출, 존재하지 않는 메소드 호출을 처리하십시오. 4. \ _ \ _ get, 동적 속성 액세스를 구현하십시오. 5. \ _ \ _ Set, 동적 속성 설정을 구현하십시오. 이러한 방법은 특정 상황에서 자동으로 호출되어 코드 유연성과 효율성을 향상시킵니다.

어떤 소프트웨어가 비트 코인을 만들 수 있습니까? 2025 년 상위 10 개 비트 코인 거래 소프트웨어 권장 사항 어떤 소프트웨어가 비트 코인을 만들 수 있습니까? 2025 년 상위 10 개 비트 코인 거래 소프트웨어 권장 사항 Feb 21, 2025 pm 09:30 PM

비트 코인 시장의 빠른 발전으로 신뢰할 수있는 거래 소프트웨어를 선택하는 것이 중요합니다. 이 기사는 효율적이고 안전하게 거래 할 수 있도록 2025 년 Top Ten Bitcoin Trading 소프트웨어를 권장합니다. 이 소프트웨어는 엄격하게 스크리닝되었으며 기능, 보안, 사용자 친화 성 및 지원 수준과 같은 요소를 고려합니다. 초보자 친화적 인 플랫폼에서 경험이 풍부한 거래자를위한 복잡한 도구에 이르기 까지이 목록에서 거래 요구에 가장 적합한 옵션을 찾을 수 있습니다.

매치 표현식 (PHP 8)과 스위치와 어떻게 다른지 설명하십시오. 매치 표현식 (PHP 8)과 스위치와 어떻게 다른지 설명하십시오. Apr 06, 2025 am 12:03 AM

PHP8에서 매치 표현식은 표현식의 값에 따라 다른 결과를 반환하는 새로운 제어 구조입니다. 1) 스위치 명령문과 유사하지만 실행 명령문 블록 대신 값을 반환합니다. 2) 경기 표현식은 엄격하게 비교되어 (===) 보안을 향상시킵니다. 3) 스위치 명세서에서 가능한 파손을 피하고 코드의 단순성과 가독성을 향상시킵니다.

Gateio Exchange App Old 버전 Gateio Exchange App Old 버전 다운로드 채널 Gateio Exchange App Old 버전 Gateio Exchange App Old 버전 다운로드 채널 Mar 04, 2025 pm 11:36 PM

Gateio Exchange 앱은 공식, 제 3 자 애플리케이션 시장, 포럼 커뮤니티 및 기타 채널을 다루는 기존 버전의 채널을 다운로드합니다. 또한 기존 버전을 쉽게 얻고 새로운 버전 또는 장치 호환성을 사용하여 불편 함 문제를 해결하는 데 도움이됩니다.

2025 통화 서클에 대한 필수 소프트웨어 요약 2025 통화 서클에 대한 필수 소프트웨어 요약 Feb 21, 2025 pm 09:42 PM

이 안내서는 통화 서클의 필수 소프트웨어 도구에 대한 개요를 제공하여 사용자가 암호화 자산을보다 효율적으로 관리하고 거래 할 수 있도록 도와줍니다. 이 소프트웨어는 거래 플랫폼에서 분석 도구 및 보안 솔루션에 이르기까지 다양한 범주를 다룹니다. 이 안내서는 사용자가 2025 년에 다가오는 암호 시장을 준비 할 수 있도록 설계되었습니다.

CSRF (Cross-Site Request Grospory) 란 무엇이며 PHP에서 CSRF 보호를 어떻게 구현합니까? CSRF (Cross-Site Request Grospory) 란 무엇이며 PHP에서 CSRF 보호를 어떻게 구현합니까? Apr 07, 2025 am 12:02 AM

PHP에서는 예측할 수없는 토큰을 사용하여 CSRF 공격을 효과적으로 방지 할 수 있습니다. 특정 방법은 다음과 같습니다. 1. 형태로 CSRF 토큰을 생성하고 포함시킨다. 2. 요청을 처리 할 때 토큰의 유효성을 확인하십시오.

See all articles