Re: How to set GET and POST variables through CLI?
| From: | John Mertic | Date: | Wed, 22 Aug 2007 16:53:20 +0000 |
| Subject: | Re: How to set GET and POST variables through CLI? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-28386@lists.php.net to get a copy of this message | ||
Any parameters passed from the command line go to the $argv array, but
you cannot specify the key ( they are put in the order in which they
appear ). So calling:
php.exe foo.php "foo1" "foo2"
would call foo.php and $argv would have:
0 => 'foo.php'
1 => 'foo1'
2 => 'foo2'
I suppose you could have something in front of the file that read the
arguments and put them into the $_GET array.
On 8/22/07, Steve Francisco <cisco@gremlin.ca> wrote:
> Hi, I'd like to use the command line interface to test my php files
> before I put them live. However I can't figure out how to pass
> variables so the php program sees them as if they came in via an HTTP
> GET request.
>
> For example, if the url would be this on the server:
> http://some.server.com/mypage.php?parm1=Hello&parm2=GoodbyeP7¨�
> ;Šâ Cb
> and in mypage.php I do something like this:
> $echo $_GET["parm1"];
> then how do I test this via the PHP command line?
>
> Am I missing something simple? I tried this but it doesn't work:
> php.exe -f mypage.php -- parm1=Hello parm2=Goodbye
>
> Thanks for any help.
> -- Steve
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
--
John Mertic "Explaining a joke
is like dissecting a frog: you
jmertic@gmail.com understand it better,
but the frog dies in the
process."
-Mark Twain