0
I have a perl script working right and a script in php tbm working right.
the only difference between the 2 is that my perl file has a command that makes a Return to the other script that calls it , and my php doesn’t have that, I need to know how to do in php a Return similar to this. Below are the details:
Part of the script that generates variables to send to the Return function
foreach (split(/\n/,$uaresponse->content)) {
my $jdata = decode_json($_);
for ( $jdata->{result}[0]->{alternative}[0] ) {
$response{utterance} = encode('utf8', $_->{transcript});
$response{confidence} = $_->{confidence};
}
}
warn "$name The response was:\n", $uaresponse->content if ($debug);
foreach (keys %response) {
warn "$name Setting variable: $_ = $response{$_}\n" if ($debug);
print "SET VARIABLE \"$_\" \"$response{$_}\"\n";
checkresponse();
}
Perl script that gives Return
sub checkresponse {
my $input = <STDIN>;
my @values;
chomp $input;
if ($input =~ /^200 result=(-?\d+)\s?(.*)$/) {
warn "$name Command returned: $input\n" if ($debug);
@values = ("$1", "$2");
} else {
$input .= <STDIN> if ($input =~ /^520-Invalid/);
warn "$name Unexpected result: $input\n";
@values = (-1, -1);
}
return @values;
}
I tried to do this here in php but evidently it’s not so because it didn’t work.
$return = '("'.$resposta.'", "'.$result['sessionId'].'", "'.$andamento.'")';
return $return;
note that in perl I am returning 2 variables but with the need to modify the system I made a php that returns 3 arguments to work the way I need
Note: I am using php 5.1.6 on this server and centos 5.11
could someone help me ? I am grateful des already your attention
humm I will test thank you
– Jasar Orion
look I still can’t because I didn’t understand with my perl script returns the data . i did the php scritp do q it does but the perl script somehow passes it to the main script and I don’t know how
– Jasar Orion