For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > December 2004 > passing $_GET, $_POST variables to command line php









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author passing $_GET, $_POST variables to command line php
Richards Noah \(IFR LIT MET\)

2004-12-29, 3:56 pm

I'm trying to test some cgi php, but do not have access to a webserver (in
any way, shape, or form). I've been trying to fudge testing by using the
CLI php.exe in the windows distribution.

I've read all the faqs about the CLI and I'm not sure if there is any way to
pass the $_GET and $_POST variables. I have yet to find any information on
this topic online, either.

If anyone has any ideas of how to do this or a better way to test, please
let me know.

Thank you all in advance for your help!

-Noah


Daniel Tryba

2004-12-29, 3:57 pm

"Richards Noah \(IFR LIT MET\)" <Noah.Richards@infineon.com> wrote:
> I'm trying to test some cgi php, but do not have access to a webserver (in
> any way, shape, or form). I've been trying to fudge testing by using the
> CLI php.exe in the windows distribution.
>
> If anyone has any ideas of how to do this or a better way to test, please
> let me know.


Ehhh, why not install a webserver? Do a search for WAMP to find some
simple installers (like http://sourceforge.net/projects/yawamp/ (nevert
used it but sounds usefull)).

Richards Noah \(IFR LIT MET\)

2004-12-29, 3:57 pm

"Daniel Tryba" <spam@tryba.invalid> wrote in message
news:41d2d0a3$0$6210$e4fe514c@news.xs4all.nl...
> "Richards Noah \(IFR LIT MET\)" <Noah.Richards@infineon.com> wrote:
(in[color=darkred]
the[color=darkred]
please[color=darkred]
>
> Ehhh, why not install a webserver? Do a search for WAMP to find some
> simple installers (like http://sourceforge.net/projects/yawamp/ (nevert
> used it but sounds usefull)).
>


As I said, I do not have access to a webserver in any way shape or form.
I've attempted to install some minimal servers for testing, but am not
entirely allowed to do so.

I am looking for an alternative to this. Anybody have any ideas?


Daniel Tryba

2004-12-29, 3:57 pm

"Richards Noah \(IFR LIT MET\)" <Noah.Richards@infineon.com> wrote:
>
> As I said, I do not have access to a webserver in any way shape or form.
> I've attempted to install some minimal servers for testing, but am not
> entirely allowed to do so.


It would be nice if you would post the complete story the first time.

> I am looking for an alternative to this. Anybody have any ideas?


Use a free webserver that support php (like geocities?)!
Pedro Graca

2004-12-29, 8:55 pm

Richards Noah (IFR LIT MET) wrote:
> I've read all the faqs about the CLI and I'm not sure if there is any way to
> pass the $_GET and $_POST variables.


I don't think so.

> If anyone has any ideas of how to do this or a better way to test, please
> let me know.


If you want to serve *web* pages you need a *web* server!

You can use PHP CLI to create text (or html) files and mail those files
to whoever you want to see them.

I am not sure about Windows, but maybe you can set it up to do that file
creation/sending after a certain address receives a mail with a
specified format, or set up a scheduled task to run that script however
often you need.

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address> )
may bypass my spam filter. If it does, I may reply from another address!
Bob

2004-12-30, 3:56 am

I'm no expert, but could you have some up front code to store data in the
arrays, run the script, directing the output to an HTML file, then open the
file using a browser?.

Like:

$HTTP_POST_VARS[var1] = "value1";
$HTTP_POST_VARS[var2] = "value2";

-- script code --

Then: php xyx.php > xyz.html

bob



"Pedro Graca" <hexkid@dodgeit.com> wrote in message
news:slrnct651a.b55.hexkid@ID-203069.user.uni-berlin.de...
> Richards Noah (IFR LIT MET) wrote:
way to[color=darkred]
>
> I don't think so.
>
please[color=darkred]
>
> If you want to serve *web* pages you need a *web* server!
>
> You can use PHP CLI to create text (or html) files and mail those files
> to whoever you want to see them.
>
> I am not sure about Windows, but maybe you can set it up to do that file
> creation/sending after a certain address receives a mail with a
> specified format, or set up a scheduled task to run that script however
> often you need.
>
> --
> Mail to my "From:" address is readable by all at http://www.dodgeit.com/
> == ** ## !! ------------------------------------------------ !! ## ** ==
> TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address> )
> may bypass my spam filter. If it does, I may reply from another address!



Pedro Graca

2004-12-30, 8:56 am

[ Please don't toppost ]
[ See http://www.greenend.org.uk/rjk/2000/06/14/quoting.html ]

Bob top-posted:
> I'm no expert, but could you have some up front code to store data in the
> arrays, run the script, directing the output to an HTML file, then open the
> file using a browser?.
>
> Like:
>
> $HTTP_POST_VARS[var1] = "value1";
> $HTTP_POST_VARS[var2] = "value2";
>
> -- script code --
>
> Then: php xyx.php > xyz.html


POST and GET (and HEAD and OPTIONS and a few other methods) are *HTTP*
methods. They are recognized by a web server. You cannot POST something
to, for example, a mail server.

PHP CLI can easily generate HTML files, but if it needs input and
there's no server listening for HTTP requests, it has to get that input
in a different way.

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address> )
may bypass my spam filter. If it does, I may reply from another address!
Chung Leong

2004-12-31, 8:55 pm

"Richards Noah (IFR LIT MET)" <Noah.Richards@infineon.com> wrote in message
news:cquhnm$2ei$1@athen03.muc.infineon.com...
> I'm trying to test some cgi php, but do not have access to a webserver (in
> any way, shape, or form). I've been trying to fudge testing by using the
> CLI php.exe in the windows distribution.
>
> I've read all the faqs about the CLI and I'm not sure if there is any way

to
> pass the $_GET and $_POST variables. I have yet to find any information

on
> this topic online, either.
>
> If anyone has any ideas of how to do this or a better way to test, please
> let me know.
>
> Thank you all in advance for your help!
>
> -Noah


Read up on the CGI specs and use CGI php.exe to mimic an actual transaction.
HTTP requests info is passed as environment variables. POST data gets into a
CGI app through stdin. With a some clever Windows Host scripting you can
create a passable development environment.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com