Daniel Brown wrote:
On 8/24/07, Steve Francisco <[EMAIL PROTECTED]> wrote:
[snip!]
If the command line doesn't have a way to cause $_GET to be populated,
then what other way of invoking PHP could I use?
-- Steve

    Steve,

    You'd need to transpose the $_GET variables from the request to
$argv variables via the CLI.  I don't know exactly how Java would
handle it, but the PHP equivalent (though rather recursive and
unnecessary, it's just here for demonstration purposes) would be:

Thanks Daniel, I can certainly do that in Java without much trouble, however I was hoping to avoid needing to do things in each php file to convert argv into $_GET. I want to be able to serve standard PHP without modifying each one.

But you made me realize there is a way. I wrote a small "pre.php" file like this:
<?php
        #
        for($i=1;$i<count($argv);$i++) {
                $variables = split("=",$argv[$i]);
                $_GET[$variables[0]] = $variables[1];
        }
?>

and in my php.ini, I set this:
auto_prepend_file =e:\php523\pre.php

Now it works fine without having to modify the php code! All I need to do is have the Java code set up the html parms as argv, and I'm done.
-- Steve

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to