Created
September 1, 2018 09:04
-
-
Save yohanes/36f9ce24c1cc61cb6aad91f3e0a7a181 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-type: application/json"); | |
$lang = "en"; | |
$dir = "/var/www/html/talkdata/"; | |
$text = $_GET['t']; | |
$m = urlencode($text); | |
$filename = $lang . "-". $m . ".mp3"; | |
$file = $dir.$filename; | |
if (!file_exists($file)) { | |
$mp3 = file_get_contents( | |
'http://translate.google.com/translate_tts?ie=UTF-8&q='. $m .'&tl='. $lang .'&total=1&idx=0&textlen=5&prev=input&client=tw-ob'); | |
file_put_contents($file, $mp3); | |
} | |
echo '{"id":"'.$filename.'"}'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To suppress