| 1 |
<?php |
| 2 |
|
| 3 |
define('ABSPATH',1); |
| 4 |
|
| 5 |
// no direct access! |
| 6 |
defined('ABSPATH') or die("No direct access"); |
| 7 |
|
| 8 |
$txt = $_GET['q']; |
| 9 |
$txt = strip_tags($txt); |
| 10 |
$txt = preg_replace('/<script\b[^>]*>(.*?)<\/script>/si', "", $txt); |
| 11 |
$txt = preg_replace('/<style\b[^>]*>(.*?)<\/style>/si', "", $txt); |
| 12 |
$txt = str_replace(array("\"","'"),"",$txt); |
| 13 |
$txt = str_replace(" ","",$txt); |
| 14 |
$txt = urlencode($txt); |
| 15 |
|
| 16 |
$lang = (string)$_GET['l']; |
| 17 |
$token = (string)$_GET['token']; |
| 18 |
if($_GET['tr_tool'] == 'g') { |
| 19 |
$type = 'audio/mpeg'; |
| 20 |
// $url = 'http://translate.google.com/translate_tts?ie=UTF-8&q=' . $txt . '&tl=' . $lang . '&client=t'; |
| 21 |
$url = 'http://translate.google.com/translate_tts?ie=UTF-8&q='.$txt.'&tl=en&tk='.$token .'&client=t'; |
| 22 |
$url = 'http://translate.google.com/translate_tts?ie=UTF-8&q='.$txt.'&tl='.$lang.'&total=1&idx=0&textlen=5&tk='.$token .'&client=tw-ob&prev=input&ttsspeed=1'; |
| 23 |
} |
| 24 |
|
| 25 |
// $agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'; |
| 26 |
$agent = 'stagefright/1.2 (Linux;Android 5.0)'; |
| 27 |
$ch = curl_init ($url) ; |
| 28 |
curl_setopt($ch, CURLOPT_URL, $url); |
| 29 |
curl_setopt($ch, CURLOPT_HEADER, 0); |
| 30 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1) ; |
| 31 |
curl_setopt($ch, CURLOPT_REFERER, 'http://translate.google.com/'); |
| 32 |
curl_setopt($ch, CURLOPT_USERAGENT, $agent); |
| 33 |
$media = curl_exec($ch) ; |
| 34 |
curl_close($ch) ; |
| 35 |
|
| 36 |
$content_length = strlen($media); |
| 37 |
|
| 38 |
header("Content-type: ".$type); |
| 39 |
header("Content-length: ".$content_length); |
| 40 |
echo $media; |
| 41 |
?> |