-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
64 lines (57 loc) · 1.68 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
$lang = $_GET["lang"];
if (!$lang) {
$lang = en;
}
$langs = array(
//'ar' => 'arabic',
'es' => 'espanol',
'en' => 'english',
'de' => 'deutsch',
'nl' => 'nederlands',
'pt' => 'português',
'it' => 'italiano',
'fr' => 'francois',
'eo' => 'esperanto'
//'hu' => 'hungaro',
//'jp' => 'japanese',
//'kr' => 'korean'
);
$t = $_GET["t"];
if ($t) {
// Create connection
$con=mysqli_connect("localhost","user","pass","tabla");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
} else {
mysqli_query($con,"INSERT INTO querys (t, l)
VALUES ('$t','$lang')");
mysqli_close($con);
}
$t = str_replace(" ", "%20", $t);
header('Content-Type: audio/mpeg');
$mp3 = file_get_contents("http://translate.google.com/translate_tts?ie=UTF-8&q=".$t."&tl=".$lang);
//echo "http://translate.google.com/translate_tts?q=".$t."&tl=en";
echo $mp3;
} else { ?>
<h1>Se dice...</h1>
<p>No recuerdas como se pronuncia alguna palabra? No hay problema, solo sigue los pasos y escucha =).</p>
<h3>Escribe lo que quieras escuchar</h3>
<form action="audio.php" method="get">
<label>Texto</label>
<input type="text" id="text" name="t" />
<h3>y en que idioma quieres escucharlo</h3>
<label for="lang">Idioma</label>
<select id="lang" name="lang">
<option value="es"> Español </option>
<option value="en"> Inglés </option>
<option value="nl" selected> Holandes </option>
<option value="de"> Alemán </option>
<option value="it"> Italiano </option>
<option value="pt"> Portugués </option>
<option value="fr"> Francés </option>
</select>
<input type="submit" value="Dale ;)">
</form>
<?php } ?>