Advertisement
Gio88

Untitled

Aug 4th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.46 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html class="no-js consumer" lang="en">
  3. <head>
  4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  5. <script>
  6. (function(e, p){
  7. var m = location.href.match(/platform=(win8|win|mac|linux|cros)/);
  8. e.id = (m && m[1]) ||
  9. (p.indexOf('Windows NT 6.2') > -1 ? 'win8' : p.indexOf('Windows') > -1 ? 'win' : p.indexOf('Mac') > -1 ? 'mac' : p.indexOf('CrOS') > -1 ? 'cros' : 'linux');
  10. e.className = e.className.replace(/\bno-js\b/,'js');
  11. })(document.documentElement, window.navigator.userAgent)
  12. </script>
  13. <meta charset="utf-8">
  14. <meta content="initial-scale=1, minimum-scale=1, width=device-width" name="viewport">
  15. <meta content=
  16. "Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier."
  17. name="description">
  18. <title>
  19. Progetto Speech Recognition e traduzione
  20. </title>
  21. <link href="https://plus.google.com/100585555255542998765" rel="publisher">
  22. <link href="//www.google.com/images/icons/product/chrome-32.png" rel="icon" type="image/ico">
  23. <link href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&amp;subset=latin" rel=
  24. "stylesheet">
  25. <link href="/intl/en/chrome/assets/common/css/chrome.min.css" rel="stylesheet">
  26. <script src="//www.google.com/js/gweb/analytics/autotrack.js">
  27. </script>
  28. <script>
  29. new gweb.analytics.AutoTrack({
  30. profile: 'UA-26908291-1'
  31. });
  32. </script>
  33. <style>
  34. #info {
  35. font-size: 20px;
  36. }
  37.  
  38. #div_start {
  39. float: right;
  40. }
  41. #headline {
  42. text-decoration: none
  43. }
  44. #credit
  45. {
  46. position: absolute;
  47. bottom: 16px;
  48. left: 80%;
  49. }
  50. #results {
  51. font-size: 14px;
  52. width: 440px;
  53. height: 200px;
  54. border:solid 2px;
  55. border-color: #999;
  56. resize: none;
  57. position:absolute;
  58. top: 30%;
  59. font-family: 'Segoe UI'
  60. }
  61. #logo{
  62. position: absolute;
  63. top: 6px;
  64. left: 30%;
  65. }
  66. #results2 {
  67. font-size: 14px;
  68. width: 440px;
  69. height: 200px;
  70. border:solid 2px;
  71. border-color: #999;
  72. resize: none;
  73. position:absolute;
  74. top: 30%;
  75. left: 50%;
  76. font-family: 'Segoe UI'
  77. }
  78.  
  79. #t2s{
  80. width: 26px;
  81. height: 26px;
  82. display: inline-block;
  83. top: 23%;
  84. left: 80%;
  85. position: absolute;
  86. cursor: pointer;
  87. border: none;
  88. background: transparent;
  89. background-image: url("./speech.png");
  90. box-shadow: initial ;
  91. }
  92. #select_language
  93. {
  94. font-size: 14px;
  95. color: #333;
  96. background: #CCC;
  97. font-family: Segoe UI;
  98. border: solid 2px;
  99. border-color:#999;
  100. position:absolute;
  101. //left: 10%;
  102. top: 23%;
  103. width: 146px;
  104. }
  105. #select_dialect
  106. {
  107. font-size: 14px;
  108. color: #333;
  109. background: #CCC;
  110. font-family: Segoe UI;
  111. border: solid 2px;
  112. border-color:#999;
  113. position:absolute;
  114. top: 23%;
  115. left: 15%;
  116. width: 146px;
  117. }
  118. #select_language2
  119. {
  120. font-size: 14px;
  121. color: #333;
  122. background: #CCC;
  123. font-family: Segoe UI;
  124. border: solid 2px;
  125. border-color:#999;
  126. position:absolute;
  127. top: 23%;
  128. left: 50%;
  129. width: 146px;
  130. }
  131. #select_dialect2
  132. {
  133. font-size: 14px;
  134. color: #333;
  135. background: #CCC;
  136. font-family: Segoe UI;
  137. border: solid 2px;
  138. border-color:#999;
  139. position:absolute;
  140. top: 23%;
  141. left: 65%;
  142. width: 146px;
  143. }
  144. #t2s:active
  145. {
  146. top: 22%;
  147. box-shadow: initial;
  148. }
  149. #pagef
  150. {
  151. position: absolute;
  152. width: 100%;
  153. height: 10%;
  154. bottom: 0;
  155. left: 0;
  156. background-color: #eeecec;
  157. }
  158. #header{
  159. position: absolute;
  160. width: 100%;
  161. height: 10%;
  162. top: 0%;
  163. left: 0%;
  164. background-color: #eeecec;
  165. }
  166. #reset
  167. {
  168. position: absolute;
  169. top: 65%;
  170. left: 8px;
  171. font-size: 14px;
  172. color: #333;
  173. background: #CCC;
  174. font-family: Segoe UI;
  175. border: solid 2px;
  176. border-color:#999;
  177. }
  178. #start_button {
  179. border: 0;
  180. background-color:transparent;
  181. padding: 0;
  182. position: absolute;
  183. top: 270px;
  184. left: 550px;
  185. right: 40px;
  186.  
  187. }
  188. .interim {
  189. color: gray;
  190. }
  191. .final {
  192. color: black;
  193. padding-right: 3px;
  194. }
  195. .button {
  196. display: none;
  197. }
  198. .marquee {
  199. margin: 20px auto;
  200. }
  201. #buttons {
  202. margin: 10px 0;
  203. position: absolute;
  204. top: 350px;
  205. left: 550px;
  206. right: 40px;
  207. font-size: 14px;
  208. color: #fff;
  209. background-color: green;
  210. font-family: Segoe UI;
  211. border: solid 2px;
  212. border-color:green;
  213. }
  214. </style>
  215. <style>
  216. a.c1 {font-weight: normal;}
  217. </style>
  218. </head>
  219. <body class="" id="grid">
  220. <div class="browser-landing" id="main">
  221. <div class="compact marquee-stacked" id="marquee">
  222. <div id = "header">
  223. <img id = "logo" src = "logo.png" width = "500" height = "70" alt = "logo"/>
  224. </div>
  225. </div>
  226. </div>
  227. <div class="compact marquee">
  228. <div id="info">
  229. <p id="info_start">
  230. Clicca sull'icona del microfono e comincia a parlare.
  231. </p>
  232. <p id="info_speak_now" style="display:none">
  233. Parla ora.
  234. </p>
  235. <p id="info_no_speech" style="display:none">
  236. Nessun riconoscimento vocale è stato trovato. Controlla le impostazioni del microfono<a href=
  237. "//support.google.com/chrome/bin/answer.py?hl=en&amp;answer=1407892">microphone settings</a>.
  238. </p>
  239. <p id="info_no_microphone" style="display:none">
  240. Nessun microfono è stato trovato. Assicurati che sia installato<a href="//support.google.com/chrome/bin/answer.py?hl=en&amp;answer=1407892">
  241. microphone settings</a> are configured correctly.
  242. </p>
  243. <p id="info_allow" style="display:none">
  244. Clicca "Consenti" per abilitare il microfono.
  245. </p>
  246. <p id="info_denied" style="display:none">
  247. Negato permesso utilizzo microfono.
  248. </p>
  249. <p id="info_blocked" style="display:none">
  250. Permesso di utilizzo microfono bloccato. Per cambiare, vai alla pagina://settings/contentExceptions#media-stream
  251. </p>
  252. <p id="info_upgrade" style="display:none">
  253. Web Speech Api non è supportato da questo browser. Effettua l'upgrade<a href=
  254. "//www.google.com/chrome">Chrome</a> alla versione 25 o dopo.
  255. </p>
  256. </div>
  257. <div id="div_start">
  258. <button id="start_button" onclick="startButton(event)"><img alt="Start" id="start_img"
  259. src="mic.gif"></button>
  260. </div>
  261. <div id="results">
  262. <span class="final" id="final_span"></span> <span class="interim" id=
  263. "interim_span"></span>
  264. </div>
  265. <div id="results2">
  266. <span class="final" id="final_span2"></span> </span>
  267. </div>
  268.  
  269.  
  270.  
  271.  
  272.  
  273. <form id="trad" name='trad' action= "progettoajax.php" method= "POST">
  274.  
  275.  
  276.  
  277. <div class="compact marquee" id="div_language">
  278. <select id="select_language" onchange="updateCountry()">
  279. </select>&nbsp;&nbsp; <select id="select_dialect">
  280. </select>
  281. </div>
  282.  
  283.  
  284. <!-- Text-to-speech's button. -->
  285. <button id = "t2s" class = "t2s" type = "button" onclick = "speech_play()"></button>
  286.  
  287. <button id = "reset" class="reset" type"button" onclick = "javascript:result.final_transcript.value = ''; javascript:results2.value = ''">Reset</button>
  288. <script>
  289. var chrmMenuBar = new chrm.ui.MenuBar();
  290. chrmMenuBar.decorate('nav');
  291. var chrmLogo = new chrm.ui.Logo('logo');
  292.  
  293. var chrmscroll = new chrm.ui.SmoothScroll('scroll');
  294. chrmscroll.init();
  295. </script>
  296. <div class="compact marquee" id="div_language">
  297. <select id="select_language2" onchange="updateCountry2()">
  298. </select>&nbsp;&nbsp; <select id="select_dialect2">
  299. </select>
  300. </div>
  301. <script>
  302. var chrmMenuBar = new chrm.ui.MenuBar();
  303. chrmMenuBar.decorate('nav');
  304. var chrmLogo = new chrm.ui.Logo('logo');
  305.  
  306. var chrmscroll = new chrm.ui.SmoothScroll('scroll');
  307. chrmscroll.init();
  308. </script>
  309. </div>
  310. </div><script src="/intl/en/chrome/assets/common/js/chrome.min.js">
  311. </script>
  312.  
  313. <form id="trad" name='trad' action= "progettoajax.php" method= "POST">
  314.  
  315. <div id="copy">
  316.  
  317. <button id="buttons" name="bottone_recupera" onclick="RecuperaButton()" value="Translate">Traduci</button>
  318.  
  319.  
  320. <script>
  321. var source='';
  322. var dest='';
  323. var final_transcript='';
  324.  
  325.  
  326.  
  327.  
  328. window.___gcfg = { lang: 'en' };
  329. (function() {
  330. var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
  331. po.src = 'https://apis.google.com/js/plusone.js';
  332. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  333. })();
  334.  
  335.  
  336.  
  337. var doubleTracker = new gweb.analytics.DoubleTrack('floodlight', {
  338. src: 2542116,
  339. type: 'clien612',
  340. cat: 'chrom0'
  341. });
  342. doubleTracker.track();
  343.  
  344. doubleTracker.trackClass('doubletrack', true);
  345. </script> <script>
  346. var langs =
  347. [
  348.  
  349.  
  350.  
  351. ['German', ['de']],
  352. ['English', ['en', 'Australia'],
  353. ['en', 'Canada'],
  354. ['en', 'India'],
  355. ['en', 'New Zealand'],
  356. ['en', 'South Africa'],
  357. ['en', 'United Kingdom'],
  358. ['en', 'United States']],
  359. ['Español', ['es', 'Argentina'],
  360. ['es', 'Bolivia'],
  361. ['es', 'Chile'],
  362. ['es', 'Colombia'],
  363. ['es', 'Costa Rica'],
  364. ['es', 'Ecuador'],
  365. ['es', 'El Salvador'],
  366. ['es', 'España'],
  367. ['es', 'Estados Unidos'],
  368. ['es', 'Guatemala'],
  369. ['es', 'Honduras'],
  370. ['es', 'México'],
  371. ['es', 'Nicaragua'],
  372. ['es', 'Panamá'],
  373. ['es', 'Paraguay'],
  374. ['es', 'Perú'],
  375. ['es', 'Puerto Rico'],
  376. ['es', 'República Dominicana'],
  377. ['es', 'Uruguay'],
  378. ['es', 'Venezuela']],
  379.  
  380. ['Français', ['fr']],
  381.  
  382.  
  383. ['Italiano', ['it', 'Italia'],
  384. ['it', 'Svizzera']],
  385.  
  386. ['Nederlands', ['nl']],
  387.  
  388. ['Polski', ['pl']],
  389. ['Português', ['pt', 'Brasil'],
  390. ['pt', 'Portugal']],
  391. ['Română', ['ro']],
  392.  
  393. ['Svenska', ['sv']],
  394. ['Türkçe', ['tr']],
  395.  
  396. ['Pусский', ['ru']],
  397.  
  398.  
  399. ['한국어', ['ko']],
  400. ['中文', ['zh', '普通话 (中国大陆)'],
  401. ['zh', '普通话 (香港)'],
  402. ['zh', '中文 (台灣)'],
  403. ['zh', '粵語 (香港)']],
  404. ['日本語', ['ja']]];
  405. for (var i = 0; i < langs.length; i++) {
  406. select_language.options[i] = new Option(langs[i][0], i);
  407. select_language2.options[i] = new Option(langs[i][0], i);
  408. }
  409.  
  410. select_language.selectedIndex = 4;
  411. select_language2.selectedIndex = 1;
  412. updateCountry();
  413. updateCountry2();
  414. select_dialect.selectedIndex = 0;
  415. select_dialect2.selectedIndex = 6;
  416. showInfo('info_start');
  417. var pippo;
  418.  
  419.  
  420.  
  421. function updateCountry() {
  422. for (var i = select_dialect.options.length - 1; i >= 0; i--) {
  423. select_dialect.remove(i);
  424. }
  425. var list = langs[select_language.selectedIndex];
  426. for (var i = 1; i < list.length; i++) {
  427. select_dialect.options.add(new Option(list[i][1], list[i][0]));
  428. }
  429. select_dialect.style.visibility = list[1].length == 1 ? 'hidden' : 'visible';
  430. }
  431. function updateCountry2() {
  432. for (var i = select_dialect2.options.length - 1; i >= 0; i--) {
  433. select_dialect2.remove(i);
  434. }
  435. var list = langs[select_language2.selectedIndex];
  436. for (var i = 1; i < list.length; i++) {
  437. select_dialect2.options.add(new Option(list[i][1], list[i][0]));
  438. }
  439. select_dialect2.style.visibility = list[1].length == 1 ? 'hidden' : 'visible';
  440. }
  441. var create_email = false;
  442.  
  443. var recognizing = false;
  444. var ignore_onend;
  445. var start_timestamp;
  446. if (!('webkitSpeechRecognition' in window)) {
  447. upgrade();
  448. } else {
  449. start_button.style.display = 'inline-block';
  450. var recognition = new webkitSpeechRecognition();
  451. recognition.continuous = true;
  452. recognition.interimResults = true;
  453. recognition.onstart = function() {
  454. recognizing = true;
  455. showInfo('info_speak_now');
  456. start_img.src = 'mic-animate.gif';
  457. };
  458. recognition.onerror = function(event) {
  459. if (event.error == 'no-speech') {
  460. start_img.src = 'mic.gif';
  461. showInfo('info_no_speech');
  462. ignore_onend = true;
  463. }
  464. if (event.error == 'audio-capture') {
  465. start_img.src = 'mic.gif';
  466. showInfo('info_no_microphone');
  467. ignore_onend = true;
  468. }
  469. if (event.error == 'not-allowed') {
  470. if (event.timeStamp - start_timestamp < 100) {
  471. showInfo('info_blocked');
  472. } else {
  473. showInfo('info_denied');
  474. }
  475. ignore_onend = true;
  476. }
  477. };
  478.  
  479. recognition.onend = function() {
  480. recognizing = false;
  481. if (ignore_onend) {
  482. return;
  483. }
  484. start_img.src = 'mic.gif';
  485. if (!final_transcript) {
  486. showInfo('info_start');
  487. return;
  488. }
  489. showInfo('');
  490. if (window.getSelection) {
  491. window.getSelection().removeAllRanges();
  492. var range = document.createRange();
  493. range.selectNode(document.getElementById('final_span'));
  494. window.getSelection().addRange(range);
  495. }
  496. if (create_email) {
  497. create_email = false;
  498. createEmail();
  499. }
  500. };
  501. recognition.onresult = function(event) {
  502. var interim_transcript = '';
  503. if (typeof(event.results) == 'undefined') {
  504. recognition.onend = null;
  505. recognition.stop();
  506. upgrade();
  507. return;
  508. }
  509. for (var i = event.resultIndex; i < event.results.length; ++i) {
  510. if (event.results[i].isFinal) {
  511. final_transcript += event.results[i][0].transcript;
  512. } else {
  513. interim_transcript += event.results[i][0].transcript;
  514. }
  515. }
  516. final_transcript = capitalize(final_transcript);
  517.  
  518. final_span.innerHTML = linebreak(final_transcript);
  519. interim_span.innerHTML = linebreak(interim_transcript);
  520. if (final_transcript || interim_transcript) {
  521. showButtons('inline-block');
  522. }
  523. };
  524. }
  525.  
  526.  
  527. function startButton(event) {
  528. if (recognizing) {
  529. recognition.stop();
  530. return;
  531. }
  532. //final_transcript = '';
  533. recognition.lang = select_dialect.value;
  534. recognition.start();
  535. ignore_onend = false;
  536. final_span.innerHTML = '';
  537. interim_span.innerHTML = '';
  538. start_img.src = 'mic-slash.gif';
  539. showInfo('info_allow');
  540. showButtons('none');
  541. start_timestamp = event.timeStamp;
  542. }
  543.  
  544. function upgrade() {
  545. start_button.style.visibility = 'hidden';
  546. showInfo('info_upgrade');
  547. }
  548. var two_line = /\n\n/g;
  549. var one_line = /\n/g;
  550. function linebreak(s) {
  551. return s.replace(two_line, '<p></p>').replace(one_line, '<br>');
  552. }
  553. var first_char = /\S/;
  554. function capitalize(s) {
  555. return s.replace(first_char, function(m) { return m.toUpperCase(); });
  556. }
  557. function createEmail() {
  558. var n = final_transcript.indexOf('\n');
  559. if (n < 0 || n >= 80) {
  560. n = 40 + final_transcript.substring(40).indexOf(' ');
  561. }
  562. var subject = encodeURI(final_transcript.substring(0, n));
  563. var body = encodeURI(final_transcript.substring(n + 1));
  564. window.location.href = 'mailto:?subject=' + subject + '&body=' + body;
  565. }
  566. function RecuperaButton() {
  567. if (recognizing) {
  568. recognizing = false;
  569. recognition.stop();
  570. var x=final_transcript;
  571. /*document.cookie= 'cookie_final='+x;
  572. source= langs[select_language.selectedIndex][1][0];
  573. document.cookie= 'cookie_source='+source;
  574.  
  575. dest=langs[select_language2.selectedIndex][1][0];
  576. document.cookie= 'cookie_dest='+dest;
  577. final_span.innerHTML=linebreak=linebreak(final_transcript);
  578. */
  579. source=langs[select_language.selectedIndex][1][0];
  580. dest=langs[select_language2.selectedIndex][1][0];
  581.  
  582. var sorgente= $("#source").val();
  583.  
  584. var destinatario= $("#dest").val();
  585. var testo=$("#x").val();
  586. alert(testo);
  587. alert(sorgente);
  588. alert(destinatario);
  589. $.post("progettoajax.php", {'sorgente':sorgente, 'destinatario':destinatario, 'testo':testo});
  590. alert(sorgente);
  591. alert(destinatario);
  592.  
  593. //pippo='<?php if (isset($translatedStr)== true){echo $translatedStr;}else{echo '';} ?>';
  594.  
  595.  
  596. /*else{
  597. }*/
  598. copy_button.style.display = 'none';
  599. copy_info.style.display = 'inline-block';
  600. showInfo('');
  601. }
  602. }
  603.  
  604.  
  605. <?php
  606. session_start();
  607. include 'HttpTranslator.php';
  608. include 'AccessTokenAuthentication.php';
  609. /*if (glob('./speech_file/*.mp3'))
  610. {
  611. $file = glob('speech_file/'.'*.mp3',GLOB_MARK);
  612. foreach ($file as $file)
  613. {
  614. if (is_dir($file))
  615. {
  616. self::deleteDir($file);
  617. }
  618. else
  619. {
  620. unlink($file);
  621. }
  622. }
  623. }
  624. */
  625. if (isset($_POST['bottone_recupera']))
  626. {
  627.  
  628. $sorgente=$_POST["sorgente"];
  629. $destinatario=$_POST["destinatario"];
  630. $testo=$_POST["testo"];
  631. echo "<script type='text/javascript'>alert('$sorgente');</script>";
  632. echo "<script type='text/javascript'>alert('$destinatario');</script>";
  633. echo "<script type='text/javascript'>alert('$testo');</script>";
  634. // Session variable for keep the languages selected
  635. // Sets session variable for langs[source][0]
  636. var_dump($_POST);
  637. /* if (isset($_COOKIE['cookie_final']))
  638. {
  639. $finaltranscript =$_COOKIE['cookie_final'];
  640.  
  641. $_SESSION['final'] = $_COOKIE['cookie_final'];
  642.  
  643.  
  644. }
  645. else{$message = "nn funziona cookie final";
  646. echo "<script type='text/javascript'>alert('$message');</script>";
  647.  
  648. }
  649.  
  650. if (isset($_COOKIE['cookie_source']))
  651. {
  652. $source =$_COOKIE['cookie_source'] ;
  653. $_SESSION['source'] = $_COOKIE['cookie_source'];
  654.  
  655.  
  656. }
  657.  
  658. else{
  659. echo "Errore lingua sorgente";
  660. }
  661. // Sets session variable for dest_lang.
  662. if (isset($_COOKIE['cookie_dest']))
  663. {
  664.  
  665. $dest =$_COOKIE['cookie_dest'] ;
  666. $_SESSION['dest'] = $_COOKIE['cookie_dest'];
  667.  
  668. }
  669.  
  670. */
  671. if('POST' == $_SERVER['REQUEST_METHOD']){
  672. // Create the authorization Header string.
  673. $authHeader = "Authorization: Bearer ". $accessToken;
  674. // Set the parameters.
  675. // Sets source language. $fromLanguage = variable, langs[source][0] = name of textarea.
  676. $fromLanguage =$_COOKIE['cookie_source'];
  677.  
  678. // Sets destination language. $toLanguage = variable, dest_lang = name of textarea.
  679. $toLanguage = $_COOKIE['cookie_dest'];
  680.  
  681. // Sets text to translate. $inputStr = variable, source_text = content of thextarea.
  682. $inputStr = $_COOKIE['cookie_final'];
  683.  
  684.  
  685. $contentType = 'text/plain';
  686. $category = 'general';
  687.  
  688. // Variable that composes the string of parameters for the transaltion
  689. $paramst = "text=".urlencode($inputStr)."&to=".$toLanguage."&from=".$fromLanguage;
  690. // URL to translate the text
  691. $translateUrl = "http://api.microsofttranslator.com/v2/Http.svc/Translate?$paramst";
  692.  
  693. //Create the Translator Object.
  694. $translatorObj = new HTTPTranslator();
  695.  
  696. //Get the curlResponse.
  697. $curlResponse = $translatorObj -> curlRequest($translateUrl, $authHeader);
  698.  
  699. //Interprets a string of XML into an object.
  700. $xmlObj = simplexml_load_string($curlResponse);
  701. foreach((array)$xmlObj[0] as $val)
  702. {
  703. $translatedStr = $val;
  704. }
  705.  
  706.  
  707. $translatedText = urlencode($translatedStr);
  708.  
  709. echo"<div id='results2'> <span class='final' id='final_span2'>".$translatedStr."</span> </div>";
  710. echo"<div id='results'> <span class='final' id='final_span'>".$inputStr."</span> </div>";
  711.  
  712. $out = 'audio/mp3';
  713. $params = "text=$translatedText&language=$toLanguage&format=$out";
  714.  
  715. //HTTP Speak method URL.
  716. $url = "http://api.microsofttranslator.com/V2/Http.svc/Speak?$params";
  717.  
  718. $translatorObj = new HTTPTranslator();
  719.  
  720. $strResponse = $translatorObj -> curlRequest($url, $authHeader);
  721.  
  722. //Create a fold to insert a speech file generated if not exists.
  723. if (!is_dir('speech_file'))
  724. {
  725. mkdir('speech_file');
  726. }
  727.  
  728. //Create the name of speech file.
  729. $var = uniqid('SPC_').".mp3";
  730. $var1 = urlencode($var);
  731.  
  732. //Save file into server directory.
  733. file_put_contents('./speech_file/'.$var1, $strResponse);*/
  734.  
  735.  
  736. }
  737. catch (Exception $e)
  738. {
  739. echo "Exception: ".$e->getMessage().PHP_EOL;
  740. }
  741.  
  742. }
  743. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement