有谁知道SNS获取邮箱联系人列表的PHP代码(最好有hotmail,gmail,yahoo)呢 有谁知道SNS获取邮箱联系人列表的PHP代码(最好有hotmail,gmail,yahoo,163等常见的邮箱)呢?我从网上找了一上午只发现163的一个还可以,其他的都不能用了。在线等 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这有个相关资料:php 模拟GMAIL,HOTMAIL(MSN),YAHOO,163,126邮箱登录(原创),可以参考下!http://topic.csdn.net/u/20101007/23/90d1bd3d-9b28-4710-ae1d-f7e795d094b3.html?17436 下面的是我找的可以的163的<form name="form1" action="" method="post"> 邮箱账号:<input type="text" name="user_name" id="user_name" value="" />@ <select name="domain"> <option value="163">163.com</option> </select><br/> 邮箱密码: <input type="text" name="user_pwd" id="user_pwd" value="" /> <br/> <input type="submit" name="submit" id="submit" value="submit" /> <br/><?phpif(!empty($_POST)){ error_reporting(0); //邮箱用户名(不带@163.com后缀的) $user = $_POST['user_name']; //邮箱密码 $pass = $_POST['user_pwd']; //目标邮箱 //$mail_addr = '[email protected]'; //登陆 $url = 'http://reg.163.com/logins.jsp?type=1&url=http://entry.mail.163.com/coremail/fcg/ntesdoor2?lightweight%3D1%26verifycookie%3D1%26language%3D-1%26style%3D-1'; $ch = curl_init($url); //创建一个用于存放cookie信息的临时文件 $cookie = tempnam('.','~'); $referer_login = 'http://mail.163.com'; //返回结果存放在变量中,而不是默认的直接输出 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_REFERER, $referer_login); $fields_post = array( 'username'=> $user, 'password'=> $pass, 'verifycookie'=>1, 'style'=>-1, 'product'=> 'mail163', 'selType'=>-1, 'secure'=>'on' ); $headers_login = array( 'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0', 'Referer' => 'http://www.163.com' ); $fields_string = ''; foreach($fields_post as $key => $value) { $fields_string .= $key . '=' . $value . '&'; } $fields_string = rtrim($fields_string , '&'); curl_setopt($ch, CURLOPT_COOKIESESSION, true); //关闭连接时,将服务器端返回的cookie保存在以下文件中 curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers_login); curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); $result= curl_exec($ch); curl_close($ch); //跳转 $url='http://entry.mail.163.com/coremail/fcg/ntesdoor2?lightweight=1&verifycookie=1&language=-1&style=-1&username=loki_wuxi'; $ch = curl_init($url); $headers = array( 'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0' ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //将之前保存的cookie信息,一起发送到服务器端 curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); $result = curl_exec($ch); curl_close($ch); //取得sid preg_match('/sid=[^\"].*/', $result, $location); $sid = substr($location[0], 4, -1); //file_put_contents('./result.txt', $sid); //通讯录地址 $url='http://g4a30.mail.163.com/jy3/address/addrlist.jsp?sid='.$sid.'&gid=all'; $ch = curl_init($url); $headers = array( 'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0' ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); $result = curl_exec($ch); curl_close($ch); //file_put_contents('./result.txt', $result); unlink($cookie); //开始抓取内容 preg_match_all('/<td class="Ibx_Td_addrName"><a[^>]*>(.*?)<\/a><\/td><td class="Ibx_Td_addrEmail"><a[^>]*>(.*?)<\/a><\/td>/i', $result,$infos,PREG_SET_ORDER); //1:姓名2:邮箱 echo "<pre>"; print_r($infos); echo "</pre>"; /* * 下面就可以为所欲为了- - */}?> 有人用过豆瓣的api吗?怎么配置豆瓣api的php环境 我想用wordpress建立一个文件共享服务器,不知道可行么? 网站页面出现报错代码 pclzip压缩指定目录,参数郁闷 真的很急,求各位大侠,友情帮助一下,小弟不感激 开发了一款wordpress插件,可以在文章首位追加指定内容,支持国人创作。 PHP的开发工具 sql查询的问题 我的PHP配置 不能正常连接 请高人指点 推荐试用phpcms。http://soft.phpcms.cn/phpcms/ 求教MAC下用MAMP开发PHP的权限问题 php 怎么实现QQ会员登录其他网站 速求解!! PowerBuilder
<form name="form1" action="" method="post">
邮箱账号:<input type="text" name="user_name" id="user_name" value="" />@ <select name="domain"> <option value="163">163.com</option> </select><br/>
邮箱密码: <input type="text" name="user_pwd" id="user_pwd" value="" /> <br/>
<input type="submit" name="submit" id="submit" value="submit" />
<br/>
<?php
if(!empty($_POST)){
error_reporting(0); //邮箱用户名(不带@163.com后缀的)
$user = $_POST['user_name'];
//邮箱密码
$pass = $_POST['user_pwd'];
//目标邮箱
//$mail_addr = '[email protected]';
//登陆
$url = 'http://reg.163.com/logins.jsp?type=1&url=http://entry.mail.163.com/coremail/fcg/ntesdoor2?lightweight%3D1%26verifycookie%3D1%26language%3D-1%26style%3D-1';
$ch = curl_init($url);
//创建一个用于存放cookie信息的临时文件
$cookie = tempnam('.','~');
$referer_login = 'http://mail.163.com';
//返回结果存放在变量中,而不是默认的直接输出
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_REFERER, $referer_login);
$fields_post = array(
'username'=> $user,
'password'=> $pass,
'verifycookie'=>1,
'style'=>-1,
'product'=> 'mail163',
'selType'=>-1,
'secure'=>'on'
);
$headers_login = array(
'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0',
'Referer' => 'http://www.163.com'
);
$fields_string = '';
foreach($fields_post as $key => $value)
{
$fields_string .= $key . '=' . $value . '&';
}
$fields_string = rtrim($fields_string , '&');
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
//关闭连接时,将服务器端返回的cookie保存在以下文件中
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers_login);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
$result= curl_exec($ch);
curl_close($ch);
//跳转
$url='http://entry.mail.163.com/coremail/fcg/ntesdoor2?lightweight=1&verifycookie=1&language=-1&style=-1&username=loki_wuxi';
$ch = curl_init($url);
$headers = array(
'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0'
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
//将之前保存的cookie信息,一起发送到服务器端
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
$result = curl_exec($ch);
curl_close($ch);
//取得sid
preg_match('/sid=[^\"].*/', $result, $location);
$sid = substr($location[0], 4, -1);
//file_put_contents('./result.txt', $sid);
//通讯录地址
$url='http://g4a30.mail.163.com/jy3/address/addrlist.jsp?sid='.$sid.'&gid=all';
$ch = curl_init($url);
$headers = array(
'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0'
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
$result = curl_exec($ch);
curl_close($ch);
//file_put_contents('./result.txt', $result);
unlink($cookie);
//开始抓取内容
preg_match_all('/<td class="Ibx_Td_addrName"><a[^>]*>(.*?)<\/a><\/td><td class="Ibx_Td_addrEmail"><a[^>]*>(.*?)<\/a><\/td>/i', $result,$infos,PREG_SET_ORDER);
//1:姓名2:邮箱
echo "<pre>";
print_r($infos);
echo "</pre>";
/*
* 下面就可以为所欲为了- -
*/
}
?>