Home >Backend Development >PHP Tutorial >PHP simulates QQ login based on curl operation
This article mainly introduces PHP to simulate QQ login based on curl operation. Interested friends can refer to it. I hope it will be helpful to everyone.
The principle is to use curl to simulate sending post login, and the cookie is saved locally
This can theoretically support permanent single QQ
<?php //http://blog.qita.in 非技术[S.T] $qqno='你的QQ'; $qqpw='QQ密码'; $cookie = dirname(__FILE__).'/cookie.txt'; $post = array( 'login_url' => 'http://pt.3g.qq.com/s?sid=ATAll43N7ZULRQ5V8zdfojol&aid=nLogin', 'q_from' => '', 'loginTitle' => 'login', 'bid' => '0', 'qq' => $qqno, 'pwd' => $qqpw, 'loginType' => '1', 'loginsubmit' => 'login', ); $curl = curl_init('http://pt.3g.qq.com/handleLogin?aid=nLoginHandle&sid=ATAll43N7ZULRQ5V8zdfojol'); 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); ?>
Summary: The above is The entire content of this article is hoped to be helpful to everyone's study.
Related recommendations:
Summary sharing of PHP processing session functions
PHP’s four basic sorting algorithms and two A search algorithm
phpThree recursive function implementation methods
The above is the detailed content of PHP simulates QQ login based on curl operation. For more information, please follow other related articles on the PHP Chinese website!