Hi there, If anyone can help me, I would be REALLY grateful. I am trying to pull the contents of another website on another server using the "echo file_get_contents('http://domain.com/index.php');" command. This works fine on some of my servers, but on others it does not get anything for 90% of my domains, but does on the other 10%. I have no idea why. The page I am trying to load is: <?php error_reporting(E_ALL ^ E_NOTICE); echo file_get_contents('http://domain.com/tos/remote.php?id=3'); ?> PHP: But if I browse to the page I want to include (http://domain.com/tos/remote.php?id=3') that always loads fine, so the problem is not there. thanks in advance for any advice Keith
Maybe "allow_url_fopen" is set to "Off" The function file_get_contents() will not work if the first parameter is a url and the php ini directive "allow_url_fopen" is "Off"
As mentioned by nabil_kadimi there is a way to block the user of file_get_contents() function. There is a way around this though using cURL, header and few other methods. The setup is a little more complex than a simple function like file_get_contents().
Thanks a lot. Thanks to your help problem now fixed. The server tech said: "The allow_url_fopen is set to on in the sever main php.ini files. So everything should be fine. If you want the custom php.ini files under your domains please get back to us with the domains list so that I can place the custom php.ini files under your all domains" But when he put it in the custom php.ini files, the problem miraculously went away! Keith