When I used Google Translate today, I found a good thing: Google translate_tts. You can hear the English pronunciation by calling this API,
saving you the trouble of uploading audio files yourself.
I wrote a calling method using PHP to save audio files locally.
is as follows:
Copy the code The code is as follows:
$newfname = '1.wmv ';
$reqBaseURL = 'http://translate.google.com/translate_tts?tl=en&q=how%20do%20you%20do';
$remote_file = fopen($reqBaseURL, "rb");
if ($remote_file){
$newf = fopen($newfname, "wb");
if ($newf){
while(!feof($remote_file)){
fwrite($newf, fread($remote_file, 1024 * 8),1024 * 8);
}
}
}
if ($remote_file) {
fclose($remote_file);
}
if ($newf) {
fclose($newf);
}
http://www.bkjia.com/PHPjc/328136.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/328136.htmlTechArticleWhen I used Google Translate today, I found a good thing: Google translate_tts. You can hear the English pronunciation by calling this API. Save yourself the trouble of uploading audio files yourself. I wrote a tune in php...