PHP Classes

POST instead of GET

Recommend this page to a friend!

      PHP Google Text to Speech  >  All threads  >  POST instead of GET  >  (Un) Subscribe thread alerts  
Subject:POST instead of GET
Summary:WHat code to POST rather than GET?
Messages:4
Author:chris edeling
Date:2014-01-16 13:58:40
Update:2014-01-16 17:19:38
 

 


  1. POST instead of GET   Reply   Report abuse  
Picture of chris edeling chris edeling - 2014-01-16 13:58:40
Neat code Mahmut, thanks.

Please explain code change required to send by POST instead of GET

Seems to be the function "text" and the line
$this->googleTranslateURL = sprintf($this->googleTranslateURL, $lang, $textToSpeak);

Chris Edeling

  2. Re: POST instead of GET   Reply   Report abuse  
Picture of Mahmut Namli Mahmut Namli - 2014-01-16 15:52:44 - In reply to message 1 from chris edeling
Thanks for your interest.

Firstly, Google API's Translate service (and including TTS) is not free. It's $20 per 1M characters of text.

This class not using Google API and making a regular GET request so you're limited to 100 characters of the text hence using GET method. This class is ideal for short sentences, texts and words.

In a nutshell, I'm planning to edit this class which can handle TTS service by using Google's API but it'll need a paid service as I said..

  3. Re: POST instead of GET   Reply   Report abuse  
Picture of chris edeling chris edeling - 2014-01-16 16:01:25 - In reply to message 2 from Mahmut Namli
Of course!

I could not understand why you said in line 24 of index.php that
"Note 1: as this is a free service, you're limited to 100 characters of the text hence using $_GET"
cos I was thinking if I put it on my site I can do as I please. I overlooked the fact that the hard work is provided by Google whose free service is limited as you say.

Anyway, I agree that 100 chars goes a long way - thanks again

  4. Re: POST instead of GET   Reply   Report abuse  
Picture of Mahmut Namli Mahmut Namli - 2014-01-16 17:19:38 - In reply to message 3 from chris edeling
Sorry, my mistake; I mean that by saying "as of this is a free service" is not my service, it's Google's service :) sorry for semantic error.

This class is totally free and of course will be.. :)