php调用Google translate_tts api实现代码
发布时间:2020-05-24 13:09:42 所属栏目:PHP 来源:互联网
导读:以下是对php调用Google translate_tts api的实现代码进行了分析介绍,需要的朋友可以过来参考下
|
今天用google翻译时,发现个好东西:Google translate_tts,调用这个api就可以听到英文发音, 如下:<div class="codetitle"><a style="CURSOR: pointer" data="43481" class="copybut" id="copybut43481" onclick="doCopy('code43481')"> 代码如下:<div class="codebody" id="code43481">$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); } (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
