Advertisement
Guest User

2captcha new way c# api example

a guest
Aug 4th, 2016
13,036
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. }
Advertisement
RAW Paste Data Copied
Advertisement