Re: cgi-output
| From: | (Richard Lynch) | Date: | Thu, 15 Jun 2000 23:54:28 +0000 |
| Subject: | Re: cgi-output | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2009@lists.php.net to get a copy of this message | ||
In article <3946D70C.6A0D472F@danielhanelt.de>, daniel@danielhanelt.de
(Daniel) wrote:
> I need to know if there is a way to get my CGI-Output (generated by a
> C-Program)
> parsed by the php-parser. I have no way to change the webserver
> settings.
> Thanks in advance. I'd appreciate any hint !
In an ideal world, you could just have one CGI hit a page first, and
another (PHP) hit it second. Maybe in fhttpd you could, but not Apache.
You could do:
$cgi = fopen("http://yourserver.com/yourCprogram.cgi",
'r') or die("CGI
failed');
while (!feof($cgi)){
$line = fgets($cgi, 100000);
echo $line, "<BR>\n";
}
Or, maybe you could execute your C from the shell:
exec("/path/to/yourCprogram.cgi -parameters here", $results, $error);
while (list(,$line) = each($results)){
echo $line, "<BR>\n";
}
if ($error){
die("OS Error Number: $error in yourCprogram.cgi: Usually
paths/permissions.<BR>\n");
}
If you just want the CGI output dumped in, the virtual() function will
work under the PHP Module compilation. If PHP is running as CGI,
virtual() will not work.
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)