using DeathByCaptcha;
/* Put your DeathByCaptcha account username and password here.
Use HttpClient for HTTP API. */
Client client = (Client)new SocketClient(username, password);
try {
double balance = client.GetBalance();
/* Put your CAPTCHA file name, or file object,
or arbitrary stream, or an array of bytes,
and optional solving timeout (in seconds) here:
*/
Captcha captcha = client.Decode(captchaFileName, timeout);
/*
//Uploading captchas with type = 2 (Coordinates API)
Captcha captcha = client.Decode(captchaFileName, timeout,
new Hashtable (){
{ "type", 2 }
});
*/
/*
//Uploading captchas with type = 3 (Image Group API)
Captcha captcha = client.Decode(captchaFileName, timeout,
new Hashtable (){
{ "type", 3 },
{"banner_text", "Select all images with meat"},
{"banner", bannerFileName}
// if you want to specify grid data
//{"grid", "4x2"}
// In this example grid 4x2 is used, you should specify it according to uploaded image.
// If you wont supply grid parameter, dbc would attempt to autodetect proper grid.
});
*/
if (null != captcha) {
/* The CAPTCHA was solved; captcha.Id property holds
its numeric ID, and captcha.Text holds its text. */
Console.WriteLine("CAPTCHA {0} solved: {1}", captcha.Id,
captcha.Text);
if (/* check if the CAPTCHA was incorrectly solved */) {
client.Report(captcha);
}
}
} catch (AccessDeniedException e) {
/* Access to DBC API denied, check your credentials and/or balance */
}