Gossamer Forum
Home : General : Chit Chat :

Timeout on RSS Feed / PHP script?

Quote Reply
Timeout on RSS Feed / PHP script?
Hi there,
I currently pull the latest forum posts from another website using a combination of their RSS feed and then reformating it on my server using a PHP script.
The results are delivered onto my home page using the following tag:
<%LWP::Simple::get('http://www.mysite.coms/rss_reformat_feed.php')%>

All of this worked very well, until I discovered that the other site has gone down. This causes my home page to be not loaded as the PHP script can nolonger connect to the other site.
This results in my home page not loading.

How can I avoid this in the future? Is there anyway of having some kind of check which would show an alternative tag if my server can't connect to the other site?

Any tips appreciated,

Piers
Quote Reply
Re: [Piers1] Timeout on RSS Feed / PHP script? In reply to
Webmasters really don't like it when people do that since it hammers their website for the rss feed and also wastes their bandwidth. You should instead have your script do some sort of caching of the rss file as well as only downloading the file if it's changed. If you get enough hits to your website, then putting the retrieval of new rss data into a cronjob would be a better choice to remove any delay there might be.

Adrian
Quote Reply
Re: [brewt] Timeout on RSS Feed / PHP script? In reply to
Thanks for the pointers,

I now run a script every 15 minutes using Cron and this stores the RSS feed into a Mysql database which is then accessed by my site.
I think this should be a little nicer to the other server and means my home page now loads far faster.

Cheers,
Piers