Jump to content

http 304 error from file_get_contents


rubing

Recommended Posts

I am trying to parse an xml/rss url, however when I try to get the url i get a http 304 not modified error.  For example if I try to retrieve the file using file_get_contents, I receive the following error:

 

Warning: file_get_contents(http://www.xroxy.com/rss) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 304 Not Modified in /home/rubing/public_html/mysite.com/public/xml.php on line 2

 

 

I guess this is b/c apache is keeping a cached copy of this page??  How do I tell it not to cache it.  Or alternatively retrieve this cached copy?? 

 

THank you very much!

Link to comment
https://forums.phpfreaks.com/topic/130133-http-304-error-from-file_get_contents/
Share on other sites

It seems like that website keeps people from making multiple requests... Try it yourself, go to the URL, and then use ctrl-f5 (reload without cache) you'll get the same problem. It's forcing people to use cache to save it the bandwidth. It's not your server, it's the way they handle multiple subsequent requests from the same IP.

Archived

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

×
×
  • Create New...

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.