Guest User

2captcha new way c# api example

a guest
Aug 4th, 2016
12,299
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public string SendRecaptchav2Request()
  2. {
  3. //POST
  4. try
  5. {
  6. System.Net.ServicePointManager.Expect100Continue = false;
  7. var request = (HttpWebRequest)WebRequest.Create("http://2captcha.com/in.php");
  8.  
  9. var postData = "key=2captcha API KEY&method=userrecaptcha&googlekey=GOOGLE KEY";//&pageurl=yourpageurl"; ;
  10. var data = Encoding.ASCII.GetBytes(postData);
  11.  
  12. request.Method = "POST";
  13.  
  14. request.ContentType = "application/x-www-form-urlencoded";
  15. request.ContentLength = data.Length;
  16.  
  17. using (var stream = request.GetRequestStream())
  18. {
  19. stream.Write(data, 0, data.Length);
  20. }
  21.  
  22. var response = (HttpWebResponse)request.GetResponse();
  23.  
  24. var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
  25.  
  26. // GET
  27. if (responseString.Contains("OK|"))
  28. {
  29. return responseString.Substring(0, 3);
  30. }
  31. else
  32. {
  33. return "Error";
  34. }
  35. }
  36. catch (Exception e)
  37. {
  38. string tt = e.Message;
  39. return tt;
  40. }
  41.  
  42. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×