Google text to audio converter php class Wednesday, May 29, 2013 Google translator support to convert text to audio in mp3 format. Although it is known to all but for my work i have coded text to audio convert php class with google. Code: text = urlencode(trim($passage)); $this->text = $passage; $this->fileDir = $saveFolderPath; } //Generate files name function fileName(){ $file = rand(1,9).time().'.mp3'; return $file; } //Convert a text to audio and return link function convert(){ $this->filePath = $this->fileDir. $this->fileName(); if(!empty($this->text)) { $this->mp3 = file_get_contents("http://translate.google.com/translate_tts?ie=utf-8&tl=en&q={$this->text}"); file_put_contents($this->filePath, $this->mp3); //chmod($filePathName, 0777); return $this->filePath; } else{ return false ; } } } ?> convert(); } ?>
Google text to audio converter php class Wednesday, May 29, 2013 Google translator support to convert text to audio in mp3 format. Although it is known to all but for my work i have coded text to audio convert php class with google. Code: text = urlencode(trim($passage)); $this->text = $passage; $this->fileDir = $saveFolderPath; } //Generate files name function fileName(){ $file = rand(1,9).time().'.mp3'; return $file; } //Convert a text to audio and return link function convert(){ $this->filePath = $this->fileDir. $this->fileName(); if(!empty($this->text)) { $this->mp3 = file_get_contents("http://translate.google.com/translate_tts?ie=utf-8&tl=en&q={$this->text}"); file_put_contents($this->filePath, $this->mp3); //chmod($filePathName, 0777); return $this->filePath; } else{ return false ; } } } ?> convert(); } ?>