Ian (lovingboth) wrote,

  • Mood:

PHP question

I want one of my websites to get data from another website. Every 12 hours, cron will run a PHP script to snaffle it and stick it in a database for later use.

Sometimes, for whatever reason, the snaffle may not work. (The other site may be down, or busy or there may be routing problems or whatever.)

The obvious thing to do is say 'try snaffling until success', but I'm reluctant to alter the php.ini setting that says scripts run for a max of 30 seconds, so...

... is there a good alternative to having a PHP script that says in effect
Is the data already snaffled?
If not, get it.

and getting cron to run this at, say, 00:00, 00:15, 00:30, 00:45 to give four chances of a successful snaffle? The check would be a really quick SQL query, so if it succeeded the first time, the subsequent runs would be very short.

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened