public class CatpchaResult
{
public string log { get; set; }
public bool status { get; set; }
public string catcha { get; set; }
}
public class AnticaptchaTopApi
{
public string apiKey = "";
public string Post(string url, object data, string method = "POST")
{
int num = 0;
NameValueCollection values;
while (num < 1)
{
try
{
using (WebClient webClient = new WebClient())
{
values = new NameValueCollection();
if (data != null)
{
data.GetType().GetProperties().ToList().ForEach(delegate (PropertyInfo pi)
{
values.Add(pi.Name, (pi.GetValue(data, null) ?? "").ToString());
});
byte[] bytes = webClient.UploadValues(url, method, values);
return Encoding.UTF8.GetString(bytes);
}
return webClient.DownloadString(url);
}
}
catch
{
}
}
return "";
}
public CatpchaResult GetCatpcha(string img,string imginstructions, int type)
{
var data = new
{
apikey = apiKey,
type = type,
imginstructions = imginstructions,
img = img
};
var rs = new CatpchaResult
{
status = false
};
try
{
var result = JsonConvert.DeserializeObject<dynamic>(Post("https://anticaptcha.top/api/captcha/[softid]", data));
if (result.success == true)
{
rs.status = true;
rs.catcha = result.captcha;
rs.log = result.message;
}
}
catch
{
}
return rs;
}
}