[转帖]php获取各大邮箱联系人地址_Android, Python及开发编程讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  Android, Python及开发编程讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 3235 | 回复: 0   主题: [转帖]php获取各大邮箱联系人地址        下一篇 
huarui.ren
注册用户
等级:上尉
经验:692
发帖:56
精华:0
注册:2013-11-5
状态:离线
发送短消息息给huarui.ren 加好友    发送短消息息给huarui.ren 发消息
发表于: IP:您无权察看 2013-11-11 9:04:58 | [全部帖] [楼主帖] 楼主

最近一直忙于项目上的QQ、MSN、邮箱(目前以实现163、126、gmail、sina、tom、sohu、yahoo等)通讯录地址获取;其中搜狐失效还需研究一下!

在网上找了一些,大部分都已经失效,为此我重新整理了一下;特别放出126的代码,163是比较容易抓取的;126有点变态多了一次跳转,比较麻烦;

QQ邮箱联系人导出 由于腾讯查的厉害,就不奉上了!

另外由同行朋友:iflower 对sohu,gmail,yahoo部分地方进行修改,程序基本完善,有需要研究的同志,请联系我!大家一起完善并跟进邮箱抓去程序;

在线demo地址: http://www.jvones.com/blog/post-200.html[code]/**

* @file class.126http.php

* 获得126邮箱通讯录列表

* @author jvones http://www.jvones.com/blog

* @date 2009-09-26

**/

class http126

{

    private function login($username, $password)

    {

    //第一步:初步登陆

    $cookies = array();

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

    curl_setopt($ch, CURLOPT_URL, "https://reg.163.com/logins.jsp?type=1&product=mail126&url=http://entry.mail.126.com/cgi/ntesdoor?hid%3D10010102%26lightweight%3D1%26verifycookie%3D1%26language%3D0%26style%3D-1");

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "username=".$username."@126.com&password=".$password);

    curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIEJAR);

    curl_setopt($ch,CURLOPT_HEADER,1);

    curl_setopt($ch, CURLOPT_TIMEOUT, TIMEOUT);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $str = curl_exec($ch);

    //file_put_contents('./126result.txt', $str);

    curl_close($ch);

    //获取redirect_url跳转地址,可以从126result.txt中查看,通过正则在$str返回流中匹配该地址

    preg_match("/replace\(\"(.*?)\"\)\;/", $str, $mtitle);

    $_url1 = $mtitle[1];

    //file_put_contents('./126resulturl.txt', $redirect_url);

    //第二步:再次跳转到到上面$_url1

    $ch = curl_init($_url1);

    curl_setopt($ch, CURLOPT_TIMEOUT, TIMEOUT);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    curl_setopt($ch,CURLOPT_COOKIEFILE,COOKIEJAR);

    curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIEJAR);

    curl_setopt($ch,CURLOPT_HEADER,1);

    $str2 = curl_exec($ch);

    curl_close($ch);

    if (strpos($contents, "安全退出") !== false)

    {

    return 0;

    }

    return 1;

    }

    /**

* 获取邮箱通讯录-地址

* @param $user

* @param $password

* @param $result

* @return array

*/

    public function getAddressList($username, $password)

    {

    if (!$this->login($username, $password))

    {

    return 0;

    }

    $header = $this->_getheader($username);

    if (!$header['sid'])

    {

    return 0;

    }

    //测试找出sid(很重要)和host

    //file_put_contents('./host.txt', $header['host']);

    //file_put_contents('./sid.txt', $header['sid']);

    //开始进入模拟抓取

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://".$header['host']."/a/s?sid=".$header['sid']."&func=global:sequential");

    curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIEJAR);

    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/xml"));

    $str = "




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论