If you're running from the command line, you can use
standard command line arguments.  In the file they'll
be entered into the array $argv[].  $argv[0] is the name
of the script called, and each other argument is
consecutively numbered.

For example the file test.php:

<?  #test.php
print("Arg0 is $argv[0]\nArgv1 is $argv[1]\n");
?>

running: c:\php\php.exe -q test.php SERVERNAME
would print:

Argv0 is test.php
Argv1 is SERVERNAME

If you want to use the same php file on the server as for
command line, just put a check at the start to see if argv
is defined and has elements, and if so, map them to your
QUERY equivalants.
(e.g. if(count(argv)>1) {$servername=$argv[1]}   )

-steve
http://www.cheatcodes.com/
http://www.gear21.com



> -----Original Message-----
> From: Scott Dowd [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, April 28, 2002 5:32 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] PHP Command Line Syntax
>
>
> I would like to schedule a series of PHP pages to run overnight from a
> Win2k/IIS/PHP4 box. An example of the url is
> http://localhost/checklist/checksingle.php?servername=SERVERNAME.
> When I try
> to execute this from a DOS prompt, "C:\PHP\PHP.EXE -q checksingle.php" it
> works fine, but when I add "?servername=SERVERNAME" as in the url, it does
> not recognize the command.
>
> "PHP Fatal error:  Unable to open checksingle.php?servername=SERVERNAME in
> Unknow
> n on line 0"
>
> Is this the best way to schedule a PHP page to run ?
>
> Thanks,
> Scott.
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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

Reply via email to