DragonWarden Posted June 26, 2006 Share Posted June 26, 2006 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 33Warning: 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 33When 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? Link to comment https://forums.phpfreaks.com/topic/12909-error-with-file_get_contents-and-fopen/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.