I’m trying to execute a straightforward PHP call to load the contents of a web page:
$result = file_get_contents("http://www.google.com");
The result coming back is a strange file not found error:
Warning: file_get_contents(http://www.google.com): failed to open stream: No such file or directory in /var/www/html/test.php on line 5
I have “allow_url_fopen = On” on my php.ini and no .htaccess files that might alter the setting in the directory. Any ideas? I’ve never had trouble with this function before on different servers.
Apparently the HTTP stream wrapper is not present, which causes this error.
I’m not sure how it was removed or how to restore it, but that would explain it! I’ve tried stream_wrapper_restore(‘http’) in case it was unregistered somehow, but that has no effect.