<EXEC_CGI "application name" "direct" "begin filter" "end filter">
<?php ExecGCI("myCGI.cgi"); ?>.
ExecCGI( application )
<?php
//-----------------------------------------------------
// ExecCGI( $app, $direct, $begin, $end )
// - - - - - - - - - - - - - - - - - - -
// Execute the cgi specified by $app and print the
// output that is between the text $begin and $end.
//
// $direct is not currently used.
//
// NOTE: This function has not been tested, use only
// if you're willing to debug.
//
// See PHP documentation for exec().
//-----------------------------------------------------
function ExecCGI( $app, $direct="", $begin="", $end="" )
{
unset($output);
exec($app,$output);
$i = 0;
if( !empty($begin) )
for(;$i<sizeof($output) && !stristr($output[$i]); $i++)
/* Search for the first line with $begin in it. */;
if( $i<sizeof($output) )
$output[$i] = substr(stristr($output[$i],$begin),strlen($begin));
for(;$i<sizeof($output) && (empty($end) || !stristr($output[$i],$end); $i++)
print $output[$i]."\n";
if( $i<sizeof($output) )
print substr($output[$i],0,-strlen(stristr($output[$i],$end)));
}
?>