note 75270 added to ref.exec

From: Date: Mon, 21 May 2007 14:46:39 +0000
Subject: note 75270 added to ref.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-126798@lists.php.net to get a copy of this message
If you are trying to use exec to run a cgi and output the contents via a php file, headers need to be seperated from the content and output seperately. Also, at least in the case of the cgi I was attempting to execute, line feeds were missing, and some javascript didn't work as a result, so you may have to add line feeds back into the resulting output. Here is the code I used to output my cgi properly... <?PHP putenv('REQUEST_METHOD=GET'); // to get your parameters passed into the cgi.. putenv('QUERY_STRING=' . $_SERVER['QUERY_STRING']); //you will know you are past the header when you //hit a blank line ('') $inheader=true; foreach($output as $val){ if($val=='') $inheader=false; if($inheader) header($val); else echo($val . "\n"); // output contents } ?> ---- Server IP: 69.39.81.135 Probable Submitter: 67.52.4.174 ---- Manual Page -- http://www.php.net/manual/en/ref.exec.php Edit -- https://master.php.net/note/edit/75270 Del: integrated -- https://master.php.net/note/delete/75270/integrated Del: useless -- https://master.php.net/note/delete/75270/useless Del: bad code -- https://master.php.net/note/delete/75270/bad+code Del: spam -- https://master.php.net/note/delete/75270/spam Del: non-english -- https://master.php.net/note/delete/75270/non-english Del: in docs -- https://master.php.net/note/delete/75270/in+docs Del: other reasons-- https://master.php.net/note/delete/75270 Reject -- https://master.php.net/note/reject/75270 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#126798) next »