Home  >  Article  >  php教程  >  PHP实现QQ登录实例代码,phpqq登录实例

PHP实现QQ登录实例代码,phpqq登录实例

WBOY
WBOYOriginal
2016-06-13 08:47:411366browse

PHP实现QQ登录实例代码,phpqq登录实例

分享一段利用PHP实现QQ登陆的代码,原理是用curl模拟发送post登录,cookie保存本地,实现真正的3GQQ登陆。这里代码理论可以支持永久单挂QQ—真正做到免费挂qq哦。

<&#63;php
function qqlogin(){
$qqno='这里填写QQ账号';
$qqpw='这里填写QQ密码';
$cookie = dirname(__FILE__).'/cookie.txt';
$post = array( 
'login_url' => 'http://pt.3g.qq.com/s&#63;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&#63;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);
// &#63;Cookie
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
$result = curl_exec($curl);
curl_close($curl);
}
&#63;>
qqlogin();

如何查看是否登陆成功:

运行过此段代码以后,你的QQ将被挤掉,弹出以下提示,这时候你可以登陆你的其它QQ号码查看你测试号码的登陆状态。

您可能感兴趣的文章:

  • QQ登录 PHP OAuth示例代码
  • PHP模拟QQ登录的方法
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