472,119 Members | 1,524 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

passing $_GET, $_POST variables to command line php

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
7 8906
"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
"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
"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
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
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
[ 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
"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.

Similar topics

2 posts views Thread by David Billson | last post: by
1 post views Thread by whatmore | last post: by
reply views Thread by DumbNewbie | last post: by
6 posts views Thread by =?iso-8859-1?q?Luis_M._Gonz=E1lez?= | last post: by
11 posts views Thread by wangzq | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.