爲什麼我在使用PHP curl時沒有獲取HTML代碼?這是我的代碼:沒有使用curl獲取HTML,爲什麼?
// $content = file_get_contents('http://www.datadiary.com/Company/311734/dimsinstituteofhotelmanagement');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.datadiary.com/Company/311734/dimsinstituteofhotelmanagement');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_COOKIESESSION, false);
$content = curl_exec($ch);
curl_close($ch);
echo $content;
設置此選項後,我無法獲得內容 – vinit
它適用於我,你是否安裝了cURL擴展?另外,有問題的資源正在爲我返回一個'500 Internal Server Error'。 – Lekensteyn
是的,它返回一個500內部服務器錯誤。但是這個URL可以在bouser中打開。 – vinit