php - What is the best way to refresh some script function every XX minutes? -
i working on football odds website first time.
i getting xml data online xml feeder, parsing xml data using php , send data mysql database, php file data , print on html document.
xml feeder has time limits each function, example: time limit league 3600s, time limit live fixture 25s etc..
i send data using 1 file called sendxmldata.php, there functions like: sendleaguestodb(), sendfixturestodb() etc..
and want run these functions every xx-xxxx seconds, each function has different time limit.
how can run functions every xx seconds, need run , when users not on website?
what best way this?
using cron job or how? if answer yes, use cron, there way run function file 25s, , same file 3600s? or need every function or time_limit create new php file run? there functions.
thanks.
you can create 2 cronjobspointing same file @jquery.php.magento.com pointed out. can pass argument choose witch function call:
1 * * * * /path_to_php/cronjob.php variable1=test variable2=test variable3=test
you use parse_str() set , access paramaters:
<?php parse_str($argv[n]); ?>
to use timeout parameter:
1 * * * * /path_to_php/cronjob.php timeout=30
and read it:
<?php $timeout = parse_str($argv[0]); ?>
Comments
Post a Comment