Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- pasing part of an URL to commandline php
July 29, 2004, 5:55 pm
rate this thread
I have an URL like this
I would like to call now the command line php like this:
php graphthis.php '?csv=/tmp/data.cvs&dir=/web/htdocs/stress&monitor=aaa'
The question is can php translate this parameter string into the $_GET
aray somehow, so I don't have to rewrite the script ?
Thanks in advance
Re: pasing part of an URL to commandline php
Most likely, you will have to add a few things to your script.
In the command-line mode, arguments are stored in the $argv
variable (also accessible via $_SERVER['argv']).
Note also that you can recognize the mode in which PHP is running
by calling the php_sapi_name() function.