$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/20100101 Firefox/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); //递归抓取LOCATION curl_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);