PluginProbe
GSpeech TTS – WordPress Text To Speech Plugin / 3.21.0
GSpeech TTS – WordPress Text To Speech Plugin v3.21.0
3.21.5 3.21.4 3.21.3 3.21.1 3.21.2 3.20.8 3.21.0 3.20.7 3.20.6 3.20.4 3.20.5 3.20.3 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.10.0 3.10.1 3.10.2 3.10.3 3.11.0 3.11.1 3.11.2 3.12.0 All 161 releases
gspeech / streamer.php

streamer.php in GSpeech TTS – WordPress Text To Speech Plugin 3.21.0, at streamer.php

41 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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("&nbsp;","",$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 ?>