I am new at cron jobs and am not sure whether this would would work.
For security purposes I thought about making a one page script that looks for certain GET values (a username, a password, and a security code) to make sure that only the computer and someone that knows all 3 can run the command.
I made the script and it works running it in a browser but is it possible to run the cron job with GET values?
a example would be me running
* 3 * * * /path_to_script/cronjob.php?username=test&password=test&code=1234
Is this possible?
The
$_GET[]
&$_POST[]
associative arrays are only initialized when your script is invoked via a web server. When invoked via the command line, parameters are passed in the$argv
array, just like C.Your command would be:
You would then use parse_str() to set and access the paramaters:
You should look into the get_opt() or $argv function.