Page 1 of 1
Calling a CGI in PHP
Posted: Mon Dec 01, 2003 2:24 pm
by oldtimer
I have a cgi script that I want to run inside a php page. But I do not want to have to use a post form. I just want to do like an include type of thing and let the cgi script do its thing and then print back that information onto the php page.
Any idea how this can be done. I have been searching but no luck.
Posted: Mon Dec 01, 2003 5:27 pm
by uberpolak
This isn't really a PHP thing, but what you need is a SSI (Server Side Include) to call the script. Insert this line (with the value changed to whatever is correct) into the page where you want it to call the script.
Don't put it into your PHP (it's not), just among the normal (X)HTML.
Code: Select all
<!--#exec cgi="/cgi-bin/myscript.cgi"-->
It looks like a comment, but it's not, leave everything alone except for the value after cgi="
Posted: Mon Dec 01, 2003 6:55 pm
by oldtimer
But what if i have the cgi on another server. I have a secure server and a non secure server. I want to be able to pass certain information over to it and then back. Right now with just the cgi it works. Just can not figure out how to do it with a php front.
Posted: Mon Dec 01, 2003 9:57 pm
by m3mn0n
Yeah it's tricky to setup.
Try a Google search for [google]passing php variables another server[/google]