note 28124 added to function.virtual

From: Date: Fri, 03 Jan 2003 05:15:27 +0000
Subject: note 28124 added to function.virtual
Groups: php.notes 
Request: Send a blank email to php-notes+get-41586@lists.php.net to get a copy of this message
I saw the note above about the length of the query string... but didn't know what it was, so have altered the code so it can post to the script. Probly only works on nix systems as it makes use of the echo function... This code also will look evaluate the result, so you can get cgi to dynamically create PHP (probly best to watch out that posted variables do not include script!) <? $CGISCRIPT="./cgi-bin/cgiscript.cgi"; // preparing the arguments passed to this PHP page $QSTRING = $QUERY_STRING; foreach ($HTTP_POST_VARS as $header=> $value ){ if($QSTRING==""){ $QSTRING = $header.'='.urlencode($value); }else{ $QSTRING = $QSTRING.'&'.$header.'='.urlencode($value); } } putenv('REQUEST_METHOD=POST'); putenv('CONTENT_TYPE=application/x-www-form-urlencoded'); putenv('CONTENT_LENGTH='.strlen($QSTRING)); putenv('QUERY_STRING='.$QSTRING); unset($return_array); exec('echo "'.$QSTRING.'"| '.$CGISCRIPT, $return_array, $return_val); //The 1st line of my script was "Content...." ... so remove it! $firstline=array_shift($return_array); //evaluate the code eval('?>'.implode($return_array,'')); ?> -- http://www.php.net/manual/en/function.virtual.php http://master.php.net/manage/user-notes.php?action=edit+28124 http://master.php.net/manage/user-notes.php?action=delete+28124 http://master.php.net/manage/user-notes.php?action=reject+28124

« previous php.notes (#41586) next »