花了一下午的时间终于可以实现web挂qq或者wap挂qq,主要的原理是利用curl参数:
用的是虚拟机有流量限制的,大家不要乱搞哦
header(“Content-Type:text/html;charset=utf-8″);
$userAgent = ‘Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16′;function re($code=0,$msg=null){
return array(‘code’ => $code, ‘msg’ => $msg);
}//获取登陆地址
function getLoginUrl(){
global $userAgent;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “http://pt.3g.qq.com/”);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //这行是设定curl是否跟随header发送的location, 重要
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_REFERER, ‘http://3g.qq.com/’);
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);$return = curl_exec($ch);curl_close($ch);
preg_match(‘/action=”.*?”/’, $return,$re);
return str_replace(array(‘action=”‘,’”‘), ”, $re[0]);;
}//登陆3gqq官网
function loginIndexPage($qq=”,$pwd=”,$loginType=2){
global $userAgent;
$loginUrl = getLoginUrl();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $loginUrl);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //这行是设定curl是否跟随header发送的location, 重要
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_REFERER, ‘http://pt.3g.qq.com/’);
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
//curl_setopt($ch, “Connection”, “Keep-Alive”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, “这里是要提交的参数”);$return = curl_exec($ch);
$header = curl_getinfo($ch);
$redirect_count = $header['redirect_count'];
curl_close($ch);
if($redirect_count == 0) {
if(preg_match(‘/登录密码错误/’, $return)) {
return re(0, ‘登陆密码错误’);
}elseif(preg_match(‘/系统检测到您的操作异常,为保证您的号码安全,请输入验证码进行验证,防止他人盗取密码/’, $return)) {
return re(0, ‘需要输入验证码,请到官网登陆下QQ,再来操作’);
}else{
return re(0, ‘未知错误’);
}
}else{
return re(1, $header['url']);
}
}
以上是部分源代码,仅供参考,目前本人测试暂时不会封号,请大家用小号测试:
API接口:
http://211.160.166.70:8095/qq_login.php?qq=qq号码&pwd=密码&loginType=2
http://www.yunchat.net/bin/qq_login.php?qq=qq号码&pwd=密码&loginType=2
loginType(1在线登陆,2隐身登陆)
登陆成功会返回类似下面的网址:
http://q16.3g.qq.com/g/s?aid=nqqchatMain&sid=Ae-YVrZOOcLMVjCMmfb3vkOf&myqq=1945943344
返回非网址则登陆失败,本接口仅供测试学习.文章来源:http://www.yunchat.net/webqq