如果我嘗試和閱讀網站的源我有時會收到如下(如圖所示例如URL):500內部服務器錯誤的file_get_contents
Warning: file_get_contents(http://www.iwantoneofthose.com/gift-novelty/golf-ball-finding-glasses/10602617.html)
[function.file-get-contents]: failed to open stream: HTTP request failed!
HTTP/1.1 500 Internal Server Error in /home/public_html/pages/scrape.html on line 165
然而自身的URL是好的。爲什麼會出現這種情況?
我嘗試以下解決方法建議,但結果相同:
$opts = array('http'=>array('header' => "User-Agent:MyAgent/1.0\r\n"));
$context = stream_context_create($opts);
$header = file_get_contents('https://www.example.com',false,$context);
現在這是莫名其妙我...
[需要HTTP 500響應體文件\ _get \ _contents(PHP)](https://stackoverflow.com/questions/6040978/need-response-body-of-http-500的可能的複製-with-file-get-contents-php) – halfer 2017-07-31 13:42:06