note 42751 deleted from function.exec by tomsommer
| From: | tomsommer@php.net | Date: | Thu, 27 May 2004 22:09:33 +0000 |
| Subject: | note 42751 deleted from function.exec by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-70216@lists.php.net to get a copy of this message | ||
Note Submitter: carl_mcdadeatyahoo.com
----
A question was asked about send information round trip through a perl script from a php script. This
is the answer I came up with. I thought I would post this because there is not enough examples for
exec() and passthru() and how to use them.
In your perl script:
Code:
#!E:\xampp\xampp\perl\bin\perl.exe
print "Content-type: text/html\n\n";
print 'hello world from outside the cgi-bin';
$ARGV[0] = $ARGV[0].' has been to perl land';
print '<br>'.$ARGV[0]; // these are variables created from arguements
print '<br>'.$ARGV[1]; // fill them and play with them and get them
print '<br>'.$ARGV[2]; // ready to send back to the PHP script
In your php:
Code:
<?php
$myVar = "";
$file="hey.cgi text1 text2 text3";// add arguements to be used as variables
ob_start();
exec($file,$myVar);
ob_end_clean ();
print "the return variable content is: <b>";
foreach ($myVar as $value) {
echo "<br>$value\n"; // remember those arguements above? They come back here!
}
print "</b>";
?>