Jump to content

Archived

This topic is now archived and is closed to further replies.

DragonWarden

Error with file_get_contents and fopen

Recommended Posts

I used fopen and file_get_contents to fetch the contents of a URL with no problems on my webhoster's site, which runs PHP 4.4.2 with Apache 1.3.34 (Unix). I then set up (for the first time) a home server (Windows XP64) running PHP 5.1.2 with Apache 2.0.55. When I try to retrieve the page [a href=\"http://www.google.com\" target=\"_blank\"]http://www.google.com[/a] using either function on my home server, I get the following errors (with the appropriate function name substituted):

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\apache\Apache2\htdocs\CD\index.php on line 33

Warning: file_get_contents(http://www.google.com) [function.file-get-contents]: failed to open stream: No error in C:\apache\Apache2\htdocs\CD\index.php on line 33

When I make the attempt on my webhoster's site, it works without problems. I have made sure that allow_url_fopen in php.ini is enabled, as some google searches had suggested. I have also tried fiddling with the user_agent field as some suggested that Apache's rejecting the request somehow due to that, but I have not been successful in banishing the warning. Does anyone have any other suggestions?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.