php验证QQ邮箱是否有效

<?php

//POST HTTP请求,返回响应结果

function post_request($url, $vars, $cookie)

{

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_HEADER,0);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POST, 1);

if($vars){

curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);

}

if($cookie){

curl_setopt($ch, CURLOPT_COOKIE, $cookie);

}

$rst = curl_exec($ch);

if (curl_errno($ch)) {

echo curl_error($ch);

//error_log(curl_error($ch));

}

curl_close($ch);

 

return $rst;

}

 

/*步骤:

1、用FF登录QQ邮箱,进入写信页

2、把你登入的QQ号填入下面:位置B

3、随便检测1个收件人邮箱,通过FireBug获取本次检测的网络请求

4、把参数中的sid填入下面:位置A

5、把头信息中的cookie填入下面:位置D

6、把要检测的多个邮箱,用半角分号“;”分割,填入下面:位置C

7、执行本PHP即可看到输出,其中罗列的为非法邮箱

8、注意需要一直保持FF中QQ邮箱的登录状态

9、一段时间后可能登录态会失效,请重复上述步骤

*/

$url = ‘http://mail.qq.com/cgi-bin/laddr_domain_check’;

$params = array(

‘acttype’ => ‘4’,

‘sid’ => ‘9LzORC_8F6Kcf248’,//位置A

‘uin’ => ‘297102152’, //位置B

‘addrfilt’ => ‘454545545ccc@qq.com;hfsw2kj@qq.com;resr23@qq.com’, //位置C

);

$cookie = ‘pgv_pvid=5115475457; ptui_loginuin=297102152@qq.com; pt2gguin=o0297102152; o_cookie=263960836; edition=en.mail.qq.com; CCSHOW=000001; ptcz=83ffe523c89e1ae4bb67c4f950d35b19aab0e9c43d51076ad440ea1addf27db1; ssl_edition=e4.mail.qq.com; ptisp=ctc; uin=o0297102152; skey=@gBk6TxM9H; p_uin=o0297102152; p_skey=Bt2ELTY7j*wLaN6lA*8kWuDEW26-8FewQGqLq-Y-u74_; pt4_token=quPIQ6Jtre0Q5Iz9CmwjtQ__; qm_antisky=297102152&8e62eeaa879efeab2a74940e18c437a29c7309803b4d240ca2e64b35706d4c33; qm_flag=0; qqmail_alias=297102152@qq.com; sid=297102152&2126af44bcaffe26c3aa6ea67114cca8,qQnQyRUxUWTdqKndMYU42bEEqOGtXdURFVzI2LThGZXdRR3FMcS1ZLXU3NF8.; qm_sid=2126af44bcaffe26c3aa6ea67114cca8,qQnQyRUxUWTdqKndMYU42bEEqOGtXdURFVzI2LThGZXdRR3FMcS1ZLXU3NF8.; qm_username=297102152; qm_domain=http://mail.qq.com; qm_ptsk=297102152&@gBk6TxM9H; new_mail_num=297102152&44’;//位置D

 

$rst = post_request($url, $params, $cookie);

 

echo $rst;

?>