0

There's no problem to include cgi output with php except when it is Text/CSS. I tried to do so with:

<?php echo system('./cgi-bin/stylegallery.cgi'); ?>

As you can see here, it returns blank: http://reboltutorial.com/gallery/stylegallery.php

whereas the cgi is returning something: http://reboltutorial.com/cgi-bin/stylegallery.cgi

I tried to add content-type:

<?php header("Content-type: text/css"); ?>
<?php echo system('./cgi-bin/stylegallery.cgi'); ?>

But nothing changed. Any idea why ? Thanks.

1 Answer 1

2

According to the PHP docs, system() only returns the last line of output from your executed script.

The passthru() function might be more suited for what you're trying to do.

Sign up to request clarification or add additional context in comments.

2 Comments

Bear in mind that passthru takes a return variable and the function itself returns void. You would have to do something along the lines of: $returnvar = ''; passthru('./cgi-bin/stylegallery.cgi', $returnvar); echo $returnvar;
I don't understand your answer as this works for Text/HTML so that reason would also apply to Text/HTML ? Now also try passthru maybe it will work better :). Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.