Rumah  >  Artikel  >  pembangunan bahagian belakang  >  php基于curl操作模拟QQ登录

php基于curl操作模拟QQ登录

墨辰丷
墨辰丷asal
2018-06-08 10:32:342438semak imbas

本篇文章主要介绍php基于curl操作模拟QQ登录,感兴趣的朋友参考下,希望对大家有所帮助。

原理是用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处理会话函数总结分享

PHP四种基本排序算法和两种查找算法

php三种递归函数实现方法

Atas ialah kandungan terperinci php基于curl操作模拟QQ登录. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn