Follow

Add random number to cronjob URL and POST data

To prevent your web server from caching your script execution results, you should add random number to your cronjob URL using the keyword __random__

For example, you set up cronjob with the URL to call

http://yoursite.com/cron.php?__random__

or

http://yoursite.com/cron.php?name=value&__random__

Every time your cronjob is executed, the __random__ keyword will be replaced with a random number, e.g.

http://yoursite.com/cron.php?10386840

or

http://yoursite.com/cron.php?name=value&10386840

There are other keywords:

__timestamp__ will be replaced with current Unix timestamp

__cronjob__ will be replaced with the cronjob ID

__execution__ will be replaced with the execution number

You can also add those keywords into your POST data (only available with HTTP Method POST or PUT).

0 Comments

Please sign in to leave a comment.