PDA

View Full Version : How can I call CGI for SSI?



Zoom
November 3rd, 2000, 08:37
I have index.php3 and I have to input CGI-script's results into php. How can I do it?(SSI in php doesn't work)

Help me, please!

cds
November 3rd, 2000, 10:44
You can try to use a script call, i.e.:

<script src="some_cgi.pl"></script>

This will work with most perl files, but not all. The other alternative is just grabbing the results of a cgi call, like grabbing an html page from somewhere, and then puting that into your PHP generated page.

The first method should work most of the time and is client side so it does not require an SSI extension. The second will always work, but requires a little more programming and a little more computation time.

[Edited by cds on 11-04-2000 at 08:39 AM]

Semiel
November 3rd, 2000, 18:13
I think there is an INCLUDE statement in php where you can include scripts (perl, php...) into your web pages...

Nick
November 3rd, 2000, 18:23
Originally posted by Semiel
I think there is an INCLUDE statement in php where you can include scripts (perl, php...) into your web pages...

I think that it's <?virtual("/cgi-bin/script.pl")?> or maybe <?include("/cgi-bin/script.pl")?>, but I think it's the virtual one.

Semiel
November 3rd, 2000, 18:30
Check out: http://www.php.net/manual/html/function.include.html

"virtual" is web server dependent...

Had to check it too :(
Im not the Library of Alexandria :)

Luqman
November 3rd, 2000, 20:22
try this <? include("http://domain.com/test.cgi"); ?>

it will work must use the URL and not the path...

Koolguy
November 3rd, 2000, 21:40
In rare cases some servers don't allow you to call cgi scripts through php.

cds
November 3rd, 2000, 21:42
The method I mentioned first is client side, so that should work. The other method I mentioned is what the others have mentioned with the include directive.

Try the second method first, then the first. PHP has funny ways of disbehaving sometimes so you may have to play with it. Definately check out the link that Semiel graciously found. The PHP manuals usually have loads of user comments after the directives so you can see how other people implemented the commands. Good luck! :)

Zoom
November 4th, 2000, 02:56
The problem is that it doesn't work :-(

cds
November 4th, 2000, 07:43
Well, not a lot of people have used the PHP's Include directive for PERL, so maybe thats another bug with PHP (although I think it should work).

Instead, try fsockopen to stream the data into your script, then printing out the results within your PHP output.