0

I have a pretty annoying problem with my new program...

I want programmatically search queries on google.

its working great but after a while google returns me their captcha page, but it isn't a regular response, it is a statuscode of 503 service unabailable and it goes directly to the catch {} with this exception and I cant get the html content that I get when I do the same thing in the browser...

I researched it on the internet and found nothing about a 503 response with html content...

I just wondered how can I get the page html source from the 503 response

thank you very much...

3 Answers3

1

I'm assuming you're getting a WebException. If so, you can access the HTTP response with something like...

try {
    // Make the request...
} catch(WebException wexc) {
    var httpResponse = (HttpWebResponse)wexc.Response;
    if(httpResponse.StatusCode == HttpStatusCode.ServiceUnavailable) {
        // You can read the response as usual here.
    } else {
        throw; // not something we care about, re-throw exception
    }
}
AKX
  • 152,115
  • 15
  • 115
  • 172
0

Did you try to check there :

Error 503 C#

Try to use Fiddler2 to get more information for us ... you can get this error from various things ...

Community
  • 1
  • 1
ChapMic
  • 26,954
  • 1
  • 21
  • 20
0

Please check google TOS:

http://support.google.com/websearch/bin/answer.py?hl=en&answer=86640

This is the reason you are getting 503.

Here is a link which might help:

http://goohackle.com/break-google-captcha/

ZeNo
  • 1,648
  • 2
  • 15
  • 28