I think you're a bit confused about the difference between a tcp and a http stream...
Ahh. That's much simpler..
Local word:String = "Hello there, mate!".Replace(" ", "+") Local Text:String = GetHTTPString("ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=" + word + "&langpair=en%7Cel") SaveText(Text, "data.txt") Local json:TJSON = TJSON.Create(Text) SaveText(json.GetValue("responseData.translatedText").ToString(), "data.txt") Function GetHTTPString:String(url:String) Local stream:TStream = OpenStream("http::" + url) If stream <> Null Local result:String = stream.ReadLine() Return result Else Return Null End If End Function
EDIT:
It'd probably be a good idea to check that the header returned is free from error (HTTP/1.X 200 OK).
How would you check the returned header using the code you posted? (AFAIK it just returns the content)EDIT2: I suppose that would be {"responseData": {"translatedText":"Γειά"}, "responseDetails": null, "responseStatus": 200}??