Run a PHP page on the server after time periods automatically -
i have php page read , write data in database. there way can run php page on server automatically (not request of client) every n seconds?
rather having cronjob, might easier/more efficient have 'daemon' style script.
a script running, , @ set intervals.
<?php while(true) { do_stuff(); sleep(30); }
(more efficent, because script doesn't need full start every time it's run. can hold configuration etc, between calls do_stuff.)
how run process background , never die?
of course 'do_stuff()' might calling script
function do_stuff() { file_get_contents('http://example.com/scripts/calc.php'); }
Comments
Post a Comment