You need to URI encode the elements of your query string.  For instance, you 
can't send "fr|en".  It has to be "fr%7Cen".  In Javascript, you can do this 
with encodeURIComponent.  Since you're apparently not using Javascript, you'll 
have to look up the equivalent in whatever language you are using.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
[EMAIL PROTECTED]

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

-------------- Original message ----------------------
From: Avatar-X <[EMAIL PROTECTED]>
>
> 
> Hello,
> 
> I am trying to write a very simple web app to translate French to
> English. But I got stalled pretty quickly while writing my app because
> the Language API returned nothing but "400 Bad Request".
> 
> Here is the URL I am calling (and some sample code):
> 
>       url = "http://ajax.googleapis.com/ajax/services/language/translate?
> v=1.0&q=bonjour&langpair=fr|en&key=(my key here)"
> 
>       xml.Open "GET", url, False
>       xml.setRequestHeader "Referer", "http://www.uer.ca/";
>       xml.Send()
> 
>       result = xml.responsetext
> 
> 
> Note that for the purposes of testing, I've hard-coded the string
> "bonjour".
> 
> The Google server invariably returns this:
> 
> Bad Request
> Error 400
> 
> I've tried changing or omitting the referer header, I've tried
> removing or changing my key, I've tried different language pairs and
> different blocks of text. I even ran the code on my server in case my
> home IP was blocked for some reason. No matter what, the error is the
> same.
> 
> Even when I click on some of the examples in the API documentation
> page -- the first click works, but if I change the URL (to change the
> word being translated, for example), it gives me the 400 error. I've
> tried other browsers and other computers.
> 
> I'm at a loss. Either I'm doing it wrong, or I've been banned for
> abuse (???)...
> 
> Can anyone help?
> Thanks!
> 
> > 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX API" 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