Re: Pass parameters via url inside a php cron job
| From: | Merlin Morgenstern | Date: | Thu, 25 Sep 2008 10:34:28 +0000 |
| Subject: | Re: Pass parameters via url inside a php cron job | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-280913@lists.php.net to get a copy of this message | ||
Hello Jochem,
thank you this has solved my problem:
bla.php 2
$tf = $argv[1];
Best regards,
Merlin
Jochem Maas wrote:
Merlin Morgenstern schreef:Hi there, I would like to run a php file via cron job and there is a parameter to be passed. Unfortunatelly this does not work: # /usr/local/bin/php /home/www/create_notification_emails.php?tf=2 Could not open input file: /home/www/create_notification_emails.php?tf=2 The problem seems to be the ?tf=2something like: "/usr/local/bin/php /home/www/create_notification_emails.php -tf=2" you can retrieve input args via $argv variable - I suggest finding a package that parses this input for you so you don't have to manually do it, search for something like "php GetOpt package" ... PEAR has one for sure.How do I pass parameters to this script? I need the same script but executed in different time frames which is passed by the parameter. Any ideas? Thank you for any hint, Merlin