Jump to content


Error with file_get_contents and fopen

  • Please log in to reply
No replies to this topic

#1 DragonWarden

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 26 June 2006 - 06:52 AM

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?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users