Home >php教程 >PHP源码 >PHP模拟QQ登录

PHP模拟QQ登录

PHP中文网
PHP中文网Original
2016-05-25 17:10:341528browse

原理是用curl模拟发送post登录,cookie保存本地 
这里代码理论可以支持永久单挂QQ 

<?php 
//http://blog.qita.in 非技术[S.T]
$qqno=&#39;你的QQ&#39;;
$qqpw=&#39;QQ密码&#39;;
$cookie = dirname(__FILE__).&#39;/cookie.txt&#39;;
$post = array(
    &#39;login_url&#39; => &#39;http://pt.3g.qq.com/s?sid=ATAll43N7ZULRQ5V8zdfojol&aid=nLogin&#39;,
    &#39;q_from&#39; => &#39;&#39;,
    &#39;loginTitle&#39; => &#39;login&#39;,
    &#39;bid&#39; => &#39;0&#39;,
    &#39;qq&#39; => $qqno,
    &#39;pwd&#39; => $qqpw,
    &#39;loginType&#39; => &#39;1&#39;,
    &#39;loginsubmit&#39; => &#39;login&#39;,
);
$curl = curl_init(&#39;http://pt.3g.qq.com/handleLogin?aid=nLoginHandle&sid=ATAll43N7ZULRQ5V8zdfojol&#39;);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie); // ?Cookie
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
$result = curl_exec($curl);
curl_close($curl);
?>

                   

以上就是PHP模拟QQ登录的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn