PHP ini file_get_contents external url

Viewed 185913

I use following PHP function:

file_get_contents('http://example.com');

Whenever I do this on a certain server, the result is empty. When I do it anywhere else, the result is whatever the page's content may be. When I however, on the server where the result is empty, use the function locally - without accessing an external URL (file_get_contents('../simple/internal/path.html');), it does work.

Now, I am pretty sure it has something to do with a certain php.ini configuration. What I am however not sure about is, which one. Please help.

8 Answers

Enable allow_url_fopen From cPanel Or WHM in PHP INI Section

Add:

allow_url_fopen=1

in your php.ini file. If you are using shared hosting, create one first.

Related