|
-
Apr 25th, 2011, 03:58 PM
#1
Web timeout
Hello,
I am trying to translate a text in excel using googleapis.
When I type the URL:
"http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=Text+to+translate&langpair=en%7Cpt"
directly in the browser I get a text response:
{"responseData": {"translatedText":"Texto para traduzir"}, "responseDetails": null, "responseStatus": 200}
which has the translated text in it.
Now I am trying to automate this in Excel. How can I send the URL and catch the response? This is part of the code I have but when it gets to objHTTP.Send, it waits until the timeout and fails. Any idea?
vb.net Code:
Function fTranslate() As String
Dim objHTTP As Object
Dim URL As String
Set objHTTP = CreateObject("Msxml2.ServerXMLHTTP.3.0")
URL = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=Text+to+translate&langpair=en%7Cpt"
objHTTP.Open "GET", URL, False
objHTTP.setTimeouts 100000, 100000, 100000, 100000
objHTTP.send ("")
fTranslate = objHTTP.ResponseText
End Function
Last edited by kaliman79912; Apr 25th, 2011 at 04:29 PM.
Reason: decided to post the whole function
More important than the will to succeed, is the will to prepare for success.
Please rate the posts, your comments are the fuel to keep helping people
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|