If I try and read a sites' source I sometimes get the following (example URL shown):
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
Yet the URL on its own is fine.. why would this happen?
I tried the following workaround suggestion but same result:
$opts = array('http'=>array('header' => "User-Agent:MyAgent/1.0
"));
$context = stream_context_create($opts);
$header = file_get_contents('https://www.example.com',false,$context);
This is baffling me now...