Couldn't resolve host name?

Anyone know why the following:

file_get_contents("http://www.domain.com/directory/file.php");

results in

[I]Warning: file_get_contents() [function.file-get-contents]: Couldn’t resolve host name in /home/account/public_html/test.php on line 2

Warning: file_get_contents(http://www.domain.com/directory/file.php) [function.file-get-contents]: failed to open stream: Permission denied in /home/account/public_html/test.php on line 2[/I]

This is on my VPS. allow_url_fopen is ON. Permissions on the directory are 777.

Read the error man: Couldn’t resolve host name
The hostname, here, is “www.domain.com”. This error tells you that the computer cannot find the server that is assigned to “www.domain.com”.

Either your server have no DNS, either you need to put a real address in there, or your DNS is misconfigured and don’t answer on your self defined zones.

I did read it, thank you.

I did use a real domain (I thought it went without saying that i wasn’t literally using domain.com - apparently not). The (real) domain and path work fine outside of the file_get_contents.

I don’t know about misconfigured DNS…

On the command line of the server, type nslookup domain.com (with your domain, of course) and see what it says. Or try pinging it. Again, from the command line of the server.

You are probably trying to get the contents of a file which is located on the same server as this script, some servers don’t allow this.

try


file_get_contents("/home/account/public_html//directory/file.php");