几天来,我尝试使用 SOAP 连接到 TTS Ivona (ivona.com) 服务。
下面是运行良好的 PHP 示例:
function txtSpeechToFile($txt, $path) {
$soapURL = "http://www.ivona.com/saasapiwsdl.php";
$user = "some@email.com";
$pwd = 'pass';
$soap = new SoapClient($soapURL);
$token = $soap->__soapCall('getToken', array('email' => $user));
print gettype($token);
$speechFile = $soap->__soapCall('createSpeechFile', array(
'token' => $token,
'md5' => md5(md5($pwd).$token),
'text' => $txt,
'contentType' => 'text/plain',
'voiceId' => 'gb_amy',
'codecId' => 'mp3/22050'
)
);
$xx = file_get_contents($speechFile['soundUrl']);
file_put_contents($path, $xx);
}
我正在尝试像这样在 Perl 中运行它:
use SOAP::Lite;
my $soap = SOAP::Lite->readable(1)->uri($urlPHP)->proxy($soapURL);
my $token = $soap->getToken({('email'=>$user)});
my $speechFile = $soap->createSpeechFile(
{
(
'token' => '$token',
'md5' => md5(md5($pwd) . '$token'),
'text' => $input,
'contentType' => 'text/plain',
'voiceId' => 'gb_amy',
'codecId' => 'mp3/22050'
)
}
);
print $speechFile;
我认为$token
与PHP的不同$token
?