2013年8月11日 星期日

Google TTS API

http://translate.google.com/translate_tts?tl=zh&q={$text}&ie=utf-8

$base_url = 'http://translate.google.com/translate_tts?';
$qs = http_build_query(array(
    'tl' => 'zh',
    'ie' => 'UTF-8',
    'q' => utf8_encode($transtext)
));
$contents = file_get_contents($base_url . $qs);
file_put_contents("test.mp3",$contents);

file_put_contents($filename,$content);

file -bi file_name
iconv for charset conversion 

沒有留言: