3

While executing this piece of code, I am getting:

The remote server returned an error: (503) Server Unavailable.

using (WebClient webClient = new WebClient())
{
    string sReturnValue = webClient.DownloadString("http://translate.google.com/translate_a/t?client=t&sl=ar&tl=en&ie=UTF-8&oe=UTF-8&q=ok");
}

How can I fix this issue?

AstroCB
  • 12,337
  • 20
  • 57
  • 73

1 Answers1

0

You can't do that. If you want to translate something with google translate, you should try reading this answer.

The reason for which you're getting this error, is because Google's servers do not allow your web client to access that url (as is their Terms of Service).


(You can't just use their webpage through code to get their services. It's against their terms of service, and they also provide an API for that purpose. There is no workaround for that, and it's kinda illegal)

Community
  • 1
  • 1
RaidenF
  • 3,411
  • 4
  • 26
  • 42