acecombat Posted August 15, 2008 Share Posted August 15, 2008 I'm trying to run a script that I added to a cron every hour to automate downloading to a local file of external resources but get this error: Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: No such host is known. in Q:\Webserver\htdocs\testscript.php on line 2 Warning: file_get_contents(http://www.abc.net.au/news/indexes/justin/rss.xml) [function.file-get-contents]: failed to open stream: Unknown error in Q:\Webserver\htdocs\testscript.php on line 2 It doesn't matter what I enter as the file path the error remains the same. I just tried the RSS XML file because I know it's plain text and I can access it fine. I don't think it has anything to do with accessing it via a transparent proxy as the error doesn't mention anything of the sort (I might be wrong however) In case it makes any difference I'm running Abyss Web Server 2.5, PHP 5.1.4 on Windows XP Pro. This is the code I was using: <?php $remoteFileContents=file_get_contents("http://www.abc.net.au/news/indexes/justin/rss.xml"); $localFilePath="l:"; $localFileName="rss.xml"; $newFileHandle = fopen($localFilePath."/".$localFileName, "w"); fwrite($newFileHandle, $remoteFileContents); fclose($newFileHandle); ?> Quote Link to comment https://forums.phpfreaks.com/topic/119777-unable-to-download-file-with-file_get_contents/ Share on other sites More sharing options...
sKunKbad Posted August 15, 2008 Share Posted August 15, 2008 Does it work as a regular php script, and just not in cron? Quote Link to comment https://forums.phpfreaks.com/topic/119777-unable-to-download-file-with-file_get_contents/#findComment-617109 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.