I have a perl script running right and a script in php tbm running right.
The only difference between the 2 is that my perl file has a command that does a return to the other script that calls it, and my php does not have that, I need to know how to do a similar return in php. Here are the details:
Part of the script that generates the 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 returns
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 obviously it is not so because it did not work.
$return = '("'.$resposta.'", "'.$result['sessionId'].'", "'.$andamento.'")';
return $return;
Note: I'm using php 5.1.6 on this server and centos 5.11
Could anyone help me? I am grateful for your attention right now.