1
我收到以下錯誤:「警告:的file_get_contents未能打開流:HTTP請求失敗,HTTP/1.0 400錯誤的請求」,而打「http://Google.com」file_get_contents無法打開流:HTTP請求失敗! HTTP/1.0 400錯誤的請求
<?php
$content = file_get_contents("http://www.google.com");
if (strpos($http_response_header[0], "200")) {
echo "SUCCESS";
}
else {
echo "FAILED";
}?>
因爲這個問題我我無法解析URL。我正在使用WAMP(Apache版本-2.2.22,PHP版本5.4.3)。
採取的步驟:1.allow_url_fopen在php.ini中啓用2.Tried對URL進行編碼3.Even使用的Curl php函數獲得同樣的問題。 4.Allowed防火牆上
請幫助。
這是不正確的。如果您提供了正確的ssl上下文,您可以使用file_get_contents從https流式傳輸數據。 –