Home >Backend Development >PHP Tutorial >PHP implements QQ login example code

PHP implements QQ login example code

WBOY
WBOYOriginal
2016-07-29 09:06:311006browse

Share a piece of code that uses PHP to implement QQ login. The principle is to use curl to simulate sending post login, and save the cookie locally to achieve real 3GQQ login. The code theory here can support permanent single-listing of QQ-it is truly free to link to QQ.

<&#63;php
function qqlogin(){
$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',
);
$url = 'http://pt.3g.qq.com/handleLogin?aid=nLoginHandle&sid=ATAll43N7ZULRQ5V8zdfojol';//请求url
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, 0); 
curl_setopt($curl, CURLOPT_URL,$url);
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);
}
?>
qqlogin();

How to check whether the login is successful:

After running this code, your QQ will be squeezed out, and the following prompt will pop up. At this time, you can log in to your other QQ number to check the login status of your test number.

PHP implements QQ login example code

The above introduces the example code of PHP to implement QQ login, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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