note 42751 added to function.exec
| From: | carl_mcdadeatyahoo dot com at rn2 dot php dot net | Date: | Thu, 27 May 2004 20:34:35 +0000 |
| Subject: | note 42751 added to function.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70213@lists.php.net to get a copy of this message | ||
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>";
?>
----
Manual Page -- http://www.php.net/manual/en/function.exec.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42751
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42751&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42751&report=yes
Search -- http://master.php.net/manage/user-notes.php