sKunKbad Posted June 29, 2008 Share Posted June 29, 2008 I'm trying to read in a file from an outside source, and it seems that either php, apache, or my server isn't letting me do it. Perhaps if I show you the simple php script and associated error you can tell me what is wrong? test.php <?php $file = file_get_contents('http://dynamic.zoneedit.com/checkip.html'); ?> associated errors Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/dns/test.php on line 3 Warning: file_get_contents(http://dynamic.zoneedit.com/checkip.html) [function.file-get-contents]: failed to open stream: Connection refused in /var/www/dns/test.php on line 3 I'm not interested in using cURL or an alternate method. I just want to know what is wrong. Quote Link to comment https://forums.phpfreaks.com/topic/112406-permission-for-url-file_get_contents-file-and-fread-not-allowed/ Share on other sites More sharing options...
sKunKbad Posted June 29, 2008 Author Share Posted June 29, 2008 After searching around I found out that those errors are from my DNS being messed up. I had configured my server to run name based virtual hosts, but apparently messed up the resolv.conf. Once I fixed that everything is OK. The real problem is that I really don't know what I'm doing... but I guess all of this is part of a learning process. Quote Link to comment https://forums.phpfreaks.com/topic/112406-permission-for-url-file_get_contents-file-and-fread-not-allowed/#findComment-577100 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.