Re: php as CGI and $_POST

From: Date: Fri, 04 Jun 2004 14:42:17 +0000
Subject: Re: php as CGI and $_POST
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-187639@lists.php.net to get a copy of this message
* Thus wrote David T-G (davidtg-php@justpickone.org): > Peter -- > > ...and then Peter Risdon said... > % > % David T-G wrote: > % > % > bash-2.05a$ /usr/local/bin/php -v > % > PHP 4.3.4 (cli) (built: Jan 6 2004 15:27:52) > % > % You probably need the cgi version - not the command line one you > % actually have. > > Ooohhhhhhhhhhh... Ouch. So there are *three* possible PHP compiles: > module, CGI, and CLI? > > OK. To save us the cost of rebuilding at this host, is there any way to > pass args to the CLI version of the script running as a CGI? You might have getenv('QUERY_STRING') for GET data and *possibly* to get the POST data you can do something like: $fp = fopen('php://stdin', 'r'); while (!feof($fp) ) $buf .= fgets($fp, 1024); fclose($fp); Then of course you're going to have to parse the query_string and post data in order to get the variable names and values.. parse_str(getenv('QUERY_STRING'), $_GET); Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#187639) next »