欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php調(diào)用Google translate_tts api實現(xiàn)代碼

 更新時間:2013年08月07日 10:25:01   作者:  
以下是對php調(diào)用Google translate_tts api的實現(xiàn)代碼進行了分析介紹,需要的朋友可以過來參考下
今天用google翻譯時,發(fā)現(xiàn)個好東西:Google translate_tts,調(diào)用這個api就可以聽到英文發(fā)音,
省掉了自己上傳音頻文件的麻煩。
我用php寫了個調(diào)用的方法,可以把音頻文件保存在本地。
如下:
復(fù)制代碼 代碼如下:

$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);
}

相關(guān)文章

最新評論