$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);