php模拟登陆163邮箱失败,求解
程序员文章站
2024-01-18 18:44:34
...
//目前本人技术只能做到这里,,无法模拟成功登陆,
//上面的邮箱可以使用,,求好心人帮忙解决。。
回复讨论(解决方案)
参考:
$user, 'password' => $pass, 'verifycookie' => 1, 'style' => -1, 'product' => 'mail163', 'selType' => -1, 'secure' => 'on' ); $fields_string = ''; foreach($fields_post as $key => $value){ $fields_string .= $key . '=' . $value . '&'; } $fields_string = rtrim($fields_string , '&'); $headers = 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' ); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);//返回结果存放在变量中,而不是默认的直接输出 curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);//关闭连接时,将服务器端返回的cookie保存在以下文件中 curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); $result= curl_exec($ch); curl_close($ch); preg_match_all('/(.*?) /i', $result,$infos,PREG_SET_ORDER); if(!empty($infos['0']['1'])){ unlink($cookie); exit(''); }else{ $G_ROOT = dirname(__FILE__); file_put_contents($G_ROOT.'/cache/cookie', $cookie); return $cookie; } } /** * * $data['url'] 请求地址 * $data['data_post'] post数据 * $data['cookie'] * **/ function curl($data){ $url = $data['url']; $data_post= $data['data_post']? $data['data_post']: false; $cookie = $data['cookie']; $headers = 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' ); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); //cookie文件 登陆之后 //POST 提交 if($data_post){ curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_post); } $result = curl_exec($ch); curl_close($ch); return $result; }声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
相关文章
相关视频
推荐阅读
-
php模拟登陆163邮箱失败,求解
-
php 模拟GMAIL,HOTMAIL(MSN),YAHOO,163,126邮箱登录(原创),该如何处理
-
PHP模拟登陆163邮箱发邮件及获取通讯录列表的方法
-
php 模拟GMAIL,HOTMAIL(MSN),YAHOO,163,126邮箱登录的详细介绍
-
PHP模拟登陆163邮箱发邮件及获取通讯录列表的方法,163通讯录
-
php 模拟GMAIL,HOTMAIL(MSN),YAHOO,163,126邮箱登录的详细介绍
-
PHP模拟登陆163邮箱发邮件及获取通讯录列表的方法
-
php模拟登陆163邮箱失败,求解
-
163.com邮箱登陆 php curl 登录163邮箱并抓取邮箱好友列表的代码(经测试)
-
PHP模拟登陆163邮箱发邮件及获取通讯录列表邮箱