How can i use POST method for Google Translate

How can i use POST method for Google Translate. I dont want to use JS for some reason, Need to do it with PHP. The following does not works.

  public static function googleTranslatePost($text = "What are you looking at", $destLang='fr', $srcLang = 'en')
  {

    $http_response = ''; 
    $ch = curl_init('http://translate.google.com/translate_t');
    curl_setopt($ch, CURLOPT_POSTFIELDS,'hl=en&ie=UTF8&text=-->this+is+a+test<--&langpair=en%7Car');
    curl_setopt($ch, CURLOPT_POST,true);
    curl_setopt($ch, CURLOPT_HEADER,false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 15);
    $http_response = curl_exec($ch);
    return $http_response; 

  }

Answers


Hey man, I've found this class on google. Let me know if that is helpful:

http://code.google.com/p/gtranslate-api-php/


Need Your Help

How to add new column to MYSQL table

php mysql add alter

I am trying to add a new column to my MYSQL table using PHP. I am unsure how to alter my table so that the new column is created. In my assessment table I have

Testing an asynchronous WCF service using MSTest

c# .net wcf async-await mstest

I've implemented a WCF service using the async\await method in C#. The service operation contract is as follows:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.