标题: 用curl无法模拟登录139邮箱
时间: 2015-02-02
$ch = curl_init( );
$headers_login = array(
'Host' => 'mail.10086.cn',
'User-Agent' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; MS-RTC LM 8; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; CIBA)',
'Accept' => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*',
'Accept_Language' => 'zh-cn',
'Accept_Encoding' => 'gzip,deflate',
// 'Accept_Charset' => 'GB2312,utf-8;q=0.7,*;q=0.7\r\n',
// 'Keep-Alive' => '115',
'Connection' => 'keep-alive',
'Content-Length' => '50',
'Content-Type' => 'application/x-www-form-urlencoded',
// 'X-Requested-With'=> 'XMLHttpRequest',
'Content_Type' => 'application/x-www-form-urlencoded',
'Cache-Control' => 'no-cache',
'Referer' => 'http://mail.10086.cn/'
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers_login);
curl_setopt($ch,CURLOPT_HEADER,1);
curl_setopt( $ch, CURLOPT_URL, "https://mail.10086.cn/Login/Login.ashx" );
// curl_setopt( $ch, CURLOPT_USERAGENT, USERAGENT );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_COOKIEJAR, COOKIEJAR );
curl_setopt( $ch, CURLOPT_TIMEOUT, TIMEOUT );
$fileds = "UserName=null&Password=null";
$fileds .= "&VerifyCode";
curl_setopt( $ch, CURLOPT_POSTFIELDS, $fileds );
ob_start( );
curl_exec( $ch );
$str = curl_exec($ch);
echo $str;exit;
$result = ob_get_contents( );
ob_end_clean( );
curl_close( $ch );
『回复列表(10|隐藏机器人聊天)』