By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,837 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

passing $_GET, $_POST variables to command line php

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
"Richards Noah \(IFR LIT MET\)" <No***********@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)).

Jul 17 '05 #2

P: n/a
"Daniel Tryba" <sp**@tryba.invalid> wrote in message
news:41**********************@news.xs4all.nl...
"Richards Noah \(IFR LIT MET\)" <No***********@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)).


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?
Jul 17 '05 #3

P: n/a
"Richards Noah \(IFR LIT MET\)" <No***********@infineon.com> wrote:
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.


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?)!
Jul 17 '05 #4

P: n/a
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!
Jul 17 '05 #5

P: n/a
Bob
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" <he****@dodgeit.com> wrote in message
news:sl*******************@ID-203069.user.uni-berlin.de...
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!

Jul 17 '05 #6

P: n/a
[ 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!
Jul 17 '05 #7

P: n/a
"Richards Noah (IFR LIT MET)" <No***********@infineon.com> wrote in message
news:cq**********@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.
Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.