1965 Posted September 28, 2007 Share Posted September 28, 2007 Hi. All. I donot know why there are errors below. I tried several times but still can not work out. The url does really exist because I use it very day in ie. But if I use PHP code, it can not work. Please help. <?php $file = file_get_contents ('http://ws.geonames.org/rssToGeoRSS?feedUrl=http%3A%2F%2Fhosted.ap.org%2Fl ineups%2FWORLDHEADS-rss_2.0.xml%3FSITE%3DRANDOM%26SECTION%3DHOME'); Echo $file; ?> In IE Warning: file_get_contents(http://ws.geonames.org/rssToGeoRSS?feedUrl=http%3A%2F%2Fhosted.ap.org%2Fl ineups%2FWORLDHEADS-rss_2.0.xml%3FSITE%3DRANDOM%26SECTION%3DHOME): failed to open stream: HTTP request failed! in D:\wwwroot\guoshesen\wwwroot\map\rssxml.php on line 3 In IE Warning: file_get_contents(http://ws.geonames.org/rssToGeoRSS?feedUrl=http%3A%2F%2Fhosted.ap.org%2Fl ineups%2FWORLDHEADS-rss_2.0.xml%3FSITE%3DRANDOM%26SECTION%3DHOME): failed to open stream: HTTP request failed! in D:\wwwroot\guoshesen\wwwroot\map\rssxml.php on line 3 In Opera: Fatal error: Maximum execution time of 30 seconds exceeded in D:\wwwroot\guoshesen\wwwroot\map\rssxml.php on line 3 Link to comment https://forums.phpfreaks.com/topic/71028-why-file_get_contents-not-work/ Share on other sites More sharing options...
rarebit Posted September 28, 2007 Share Posted September 28, 2007 look at this for ref (see user comments): http://uk3.php.net/manual/en/function.file-get-contents.php It could be because of timeout, however, it works for me fine... Link to comment https://forums.phpfreaks.com/topic/71028-why-file_get_contents-not-work/#findComment-357360 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.