Page 1 of 1

Executing a CGI scripts

Posted: Mon Sep 23, 2002 9:42 am
by PingLeeQuan
I am converting some code from .SHTML to PHP. In SHTML, we can use the following statent to execute a cgi script that resodes om cgi-bin.


<!--#exec cgi="./cgi-bin/banner.cgi" --><!--#exec cgi="./cgi-bin/random.cgi" -->

how can i call the same script using php. I used
<? include "./cgi-bin/banner.cgi";
include "./cgi-bin/random.cgi";
?>

But with no luck
amy sugestions?
thanks
--Quan

Posted: Mon Sep 23, 2002 9:47 am
by nielsene
I think you'll want to look into system() or less likely exec()

Eric

Posted: Mon Sep 23, 2002 10:50 am
by PingLeeQuan
thanks for your reply... i tried both "system()" and "exec()" but none worked. I also tried passthru() but no luck... the random image is not being displaied and no errors either. I must be doing somthing wrong but i cannot figure it out.

this is what i did

$y="#exec cgi='./cgi-bin/random.cgi'";
passthru ($y);