[PHP] Pass parameters via url inside a php cron job

2008-09-25 Thread Merlin Morgenstern

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=2

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Pass parameters via url inside a php cron job

2008-09-25 Thread Aschwin Wesselius

Merlin Morgenstern wrote:

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=2

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


Hi Merlin,

Commandline arguments (for things like Cron) are a bit different than 
URL parameters.


Try lookup information on argv and argc:

http://www/php.net/features.commandline
--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other'/


Re: [PHP] Pass parameters via url inside a php cron job

2008-09-25 Thread Jochem Maas
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=2

something 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
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Pass parameters via url inside a php cron job

2008-09-25 Thread Merlin Morgenstern

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=2


something 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





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Pass parameters via url inside a php cron job

2008-09-25 Thread Daniel Brown
On Thu, Sep 25, 2008 at 6:34 AM, Merlin Morgenstern
[EMAIL PROTECTED] wrote:
 Hello Jochem,

 thank you this has solved my problem:
 bla.php 2
 $tf = $argv[1];

Conversely, on a *NIX system, if you want to grab it via the web -
locally or from a remote server - you can do this:


* * * * * /bin/env GET
http://www.example.com/index.html?example=given;  /dev/null 21
(^--- cron schedule) (^--- your URL)

-- 
/Daniel P. Brown
More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php