Google Translate in VB.NET

joshkrak

New member
Joined
Nov 17, 2006
Messages
1
Location
Bath, OH
Programming Experience
1-3
Hi everyone!

I trying to write a app to do some chinese->english translation using google. I have all the code down to generate the right URL, i.e.

http://translate.google.com/translate_t?text=%E4%BD%A0%E5%A5%BD&hl=en&langpair=zh-CN|en&tbb=1&ie=utf-8

I can paste that into a browser and it works, but when I try to request the page using msxml 6.0 I get a 403 error (forbidden). I tried requesting "www.google.com" first, thinking maybe I need a cookie, and google.com returns fine, but still when I go on to the translate url I get the 403. Is there anyway around this, maybe changing my request header?

I also tried another approach with the WebBrowser control. I had a little more success using it; the page gets returned with no 403, but, well hard to explain unless you look at this page:

http://translate.google.com/transla...&tbb=1&ie=utf-8

so if you put that in your browser, you see ?? (or chinese characters if you have the language pack installed) in the 'Original Text:' box, and "Hello" as the translation. However, when I use this same URL in the webbrowser control of vb.net the returned page has ?? as the 'Original Text:' and "-" as the translated text.

Now this is really making me go bonkers. Anyone tell me what is going on? I will bow down if you help me through this
 
Back
Top