$header[] = 'Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,application/x-shockwave-Flash, text/html, * ' . '/* ';$header[] = 'Accept-Language: zh-cn ';$header[] = "User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101Firefox/25.0";$ch= curl_init();//初始化curl
//允许curl提交后,网页重定向curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);//将curl提交后的header返回curl_setopt($ch, CURLOPT_HEADER, 1);//递归抓取LOCATIONcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);//以上处理重定向curl_setopt($ch, CURLOPT_URL,$url);//设置链接curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);//HTTPS必须设置不验证curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,FALSE);//HTTPS必须设置不验证curl_setopt($ch, CURLOPT_RETURNTRANSFER,TRUE);//设置是否返回信息curl_setopt($ch, CURLOPT_HTTPHEADER,$header);//设置HTTP头$html= curl_exec($ch);//接收返回信息curl_close($ch);