Re: calling perl from within php

From: Date: Tue, 16 Jan 2001 03:58:40 +0000
Subject: Re: calling perl from within php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-34754@lists.php.net to get a copy of this message
> We are running PHP 4 on a Solaris 2.7 box with Apache 1.3.11 with mod_perl > 1.24. > We need to communicate with 3rd-party Perl APIs from within PHP to handle > processing of a form. The API functions each expect an associated array and > will return a result value to the calling party. The Perl scripts munge the actual array passed in?... I dunno if you can do that... > I would assume that we would use exec( 'perl cgi-bin/myscript.pl', > $assoc_array, $return_value) to do this, placing the perl script I write to > handle the values in the server's cgi-bin directory. I would expect it to be more like: $command = "/usr/bin/perl cgi-bin/myscript.pl "; while (list($key, $value) = each($assoc_array); $command .= "$key=$value "; } exec($command, $output, $error); while (list(,$line) = each($output)){ echo $line, "<BR>\n"; } if ($error){ echo "OS Error $error<BR>\n"; } Not sure at all if myscript.pl will take the array that way: You may need to write a wrapper script to take key/value pairs and bundle them up to pass off to myscript.pl

« previous php.general (#34754) next »