Forum Moderators: coopster

Message Too Old, No Replies

Triggering a RSS feed at a certain time every day

         

neophyte

3:46 am on Oct 15, 2009 (gmt 0)

10+ Year Member



Hello All -

I suspect this may not be the right forum for this question (so Admin please feel free to move it where it may be more appropriate) but I'll try it here to begin with.

I've got a weather feed for a project that NEEDS to be updated at 4am local Philippine time.

Everytime the page loads, the script checks the last feed update in the db and - if 24 hours has expired since the last update - a new feed is pulled, appropriate db tables are updated and everything is okay.

BUT - now I've realized - the 7 day forecast element of the script won't display correctly unless the feed is updated at 4am local What's the chances of someone NOT hitting the site at or around 4am? Hummm... who knows? Somebody MAY be looking at the site at or around this time but, of course, there's no guarantee.

So... I was wondering if anyone else had this challenge (of automating a feed pull at a certain time of day) and has found a solution to this particular challenge?

All ideas/options/guidance greatly appreciated!

Neophyte

eelixduppy

3:51 am on Oct 15, 2009 (gmt 0)



>> Everytime the page loads

There is never any need to CHECK whether it has been 24 hours or not. There should be two scripts in play here. One that you have set in place now, except remove everything that checks the last update and the updating routines. Move the updating routine to a separate script outside of the public web directory and run a cron every day at 4:00 AM that updates the news feed. This is a much more realistic way of doing this, and in fact you'll find it will work rather nicely and you can guarantee that it will update each time.

neophyte

6:01 am on Oct 15, 2009 (gmt 0)

10+ Year Member



eelixduppy -

>>run a cron every day at 4:00 AM that updates the news feed<<

Wow, I'd never thought of that! Never done a Cron either - although I've read about it... mostly having to do with mass-emailings.

Really appreciate the tip! Would this method of updating an RSS feed on a particular schedule be considered a "best practices" way of dealing with this type of challenge?