I know this subject has been beaten to death, but bear with me.  I
couldn't find the answer to my problem.  I am accessing the google
translate with curl thru php, and no matter what i do i keep getting
back the response invalid language pair.  Here is my code ($tlang =
the language that I want translated to, $ttext = the text to be
translated.  The text will always be translated from english.

function translate($transText,$tlang){
          define('POSTURL', 'http://ajax.googleapis.com/ajax/services/
language/translate');
          // INITIALIZE ALL VARS
          $ch='';
          $Rec_Data='';

          $ch = curl_init(POSTURL);
          curl_setopt($ch, CURLOPT_POST          ,1);
          curl_setopt($ch, CURLOPT_POSTFIELDS        ,
          'q='. urlencode($transText). '&v=1.0&hl='. urlencode($tlang));

          curl_setopt($ch, CURLOPT_FOLLOWLOCATION    ,1);
          curl_setopt($ch, CURLOPT_HEADER            ,0);    // DO NOT RETURN
HTTP HEADERS
          curl_setopt($ch, CURLOPT_RETURNTRANSFER    ,1);    // RETURN THE
CONTENTS OF THE CALL
          $Rec_Data = curl_exec($ch);



Thank you in advance for your help!!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to