Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Geoff Winkless
July 15, 2005, 1:44 pm
rate this thread
My knowledge of php is regrettably poor but I need to call a third-party
php script from within a bash cgi script (don't ask why, it's a long
story). Now normally (with eg perl-cgi) to do this I need to set
QUERY_STRING and REQUEST_METHOD appropriately; however with php this
doesn't work, the $_REQUEST array is empty.
$ export QUERY_STRING='test=1&wibble=2';export REQUEST_METHOD=GET;php -n
What do I need to set in order for the _REQUEST variable to be populated
Re: getting arguments from a shellscript into $_REQUEST when faking call from a web server
$_REQUEST is filled in by the web server interface. They do not come from the
environment. There also are no $_GET, $_SERVER or similar web server associated
values. If you needed these, you would have to call another PHP program to set
the values, then include the program you want to run.
If you want to write them to the environment, you can get them through the $_ENV
array. But an easier way is to just use argc and argv to access the values as
command line variables, i.e.
myprog test=1 wibble=2
The program will receive:
argv = "myprog"
argv = "test=1"
argv = "wibble=2"
Remove the "x" from my email address
JDS Computer Training Corp.