我使用curl。幾天來,Curl顯示了一個空白頁。
主頁面/kenteken/他顯示的沒有問題。但如果有像/kenteken/TF172H這樣的文本,它就會顯示一個空白頁。
我希望有人能幫忙。
$ktk = $_GET['kenteken'/span>] 。
//創建Curl資源 //創建Curl資源 //創建Curl資源
$ch = curl_init()。
//設定url $ch = curl_init()
curl_setopt($ch, CURLOPT_URL, "https://finnik.nl/kenteken/"/span> . $ktk)。)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1) 。
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0(兼容;MSIE 6.0;Windows NT 5.1;SV1)")。
curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com") 。
curl_setopt($ch, CURLOPT_AUTOREFERER, true)。
//$output包含輸出字串。
$output = curl_exec($ch)。
//關閉curl資源以釋放系統資源。
curl_close($ch)。
print_r($output)。
uj5u.com熱心網友回復:
如果你在瀏覽器中打開Developer Console - Network選項卡去看這個URL,你會看到它被重定向到一個小寫的URL。你可以添加這一行,讓它跟隨重定向:
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/319767.html
標籤:
