Scratching my head a bit now with this.
I am trying to get a file from a remote url. I can save contents from local files, but can't from remote.
This works:
file_put_contents(
'file1.xml',
file_get_contents('file2.xml')
);
This doesn't:
file_put_contents(
'file1.xml',
file_get_contents('http://www.domain.com/xmlapi/search.aspx?query=places&lid=38')
);
Oddly enough my other scripts worked ok at first try but none will access the remote url now.
I have recently started to host my new php files on Heart Internet. I have similar scripts on other servers which give no problems at all.
This is the error I get:
Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/sites/mydomain/myfile.php on line 5`
Warning: file_get_contents(http://www.domain.com/xmlapi/search.aspx?query=places&lid=38) [function.file-get-contents]: failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/sites/mydomain/public_html/myfile.php on line 5`
allow_url_fopen
is set to On
Different domains
check the php settings...
it may be due to security issue... "allow_url_fopen = On"