A kind person sent me the following code. I have not tried yet !
Please let me know if you have found an easier way.
Peter
The author: Julia juliam@canada.com
The PERL program is called "PERL_prg" and needed several input
variables from my PHP script.
** Step 1.) I concatenated all PHP variables into a string:
$input_word. Variables were separated by blanks
(e.g. $input_word = "var1 var2 var3")
**Step 2.) I wrote a small PERL program called callcp.pl which
makes the interface between PHP and PERL (see step 3).
This PERL program is called from the PHP script in the following
way:
$input = "perl perl/callcp.pl " . $input_word;
exec($input,&$PERLout,&$status);
$PERLout will be the output variables calculated by the PERL
program PERL_prg.
**Step 3.) The interface prg. "callcp.pl" first transferred the PHP
input parameters into an array PerlParams, which could be used
by the PERL program. It then called PERL_prg, calculated
something which was returned in "result".
--> Now the important thing to get the PERL variables back to
PHP: you have to include the print statement at the end of callcp.pl.
I hope this helps.
Good luck
Julia
---------callcp.pl-------
my(@PerlParams);
for ($i=0; $i <= $#ARGV; $i++) {
push(@PerlParams, $ARGV[$i]);
}
my @result = &PERL_prg(@PerlParams);
#..write result to output file
for(@result)
{
print "$_\n";
}