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: <? foreach($_GET as $p => $v) { $data .= " ".$p."=".$v; } exec('`which php` '.$filename.$data,$ret); // This would work on Linux.... // exec('X:\path\to\php.exe '.$filename.$data,$ret); ?> Then, in the PHP script, if it wants $_GET variables, you simple reverse-transpose the variables like so: <? // cliscript.php // Test this from the CLI like so: // php cliscript.php nothing=nill apple=orange foo=bar testvar=itworks for($i=1;$i<count($argv);$i++) { $variables = split("=",$argv[$i]); $_GET[$variables[0]] = $variables[1]; } echo $_GET['testvar']."\n"; ?> Of course, remember to sanitize all of your input properly. Someone else will probably provide a better example than this in some way, but in the interest of a quick reply, that will get you started. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Hey, PHP-General list.... 50% off for life on web hosting plans $10/mo. or more at http://www.pilotpig.net/. Use the coupon code phpgeneralaug07 Register domains for about $0.01 more than what it costs me at http://domains.pilotpig.net/. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php