- Регистрация
- 03.06.2020
- Сообщения
- 2
- Благодарностей
- 1
- Баллы
- 3
I've written a simple program that sends CAPTCHA image to the CapMonster for solving and then outputs a subsequent response from CapMonster to the Console. I expect that the response will contain an answer to my CAPTCHA. Instead, CapMonster's response contains just the following text: OK|1
Question: what should I do in order for the CapMonster to respond to my request with a solution to CAPTCHA?
I expect the response to look something like this:
OK| 397
Where 397 is the solution to my captcha.
Here is the code of my program:
Question: what should I do in order for the CapMonster to respond to my request with a solution to CAPTCHA?
I expect the response to look something like this:
OK| 397
Where 397 is the solution to my captcha.
Here is the code of my program:
C#:
string host = "http://127.0.0.3/in.php";
string file = @"captcha.png";
string mime = "image/png";
string ua = "Bot 1.0";
// Read file data
FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read);
byte[] data = new byte[fs.Length];
fs.Read(data, 0, data.Length);
fs.Close();
// Generate post objects
Dictionary<string, object> postParameters = new Dictionary<string, object>();
postParameters.Add("Task", "Select all images with cars");
postParameters.Add("CapMonsterModule", "ZennoLab.ReCaptcha2");
postParameters.Add("file", new FormUpload.FileParameter(data, Path.GetFileName(file), mime));
// Create request and receive response
HttpWebResponse webResponse = FormUpload.MultipartFormDataPost(host, ua, postParameters);
// Process response
StreamReader responseReader = new StreamReader(webResponse.GetResponseStream());
string fullResponse = responseReader.ReadToEnd();
webResponse.Close();
//return fullResponse;
Console.WriteLine(fullResponse);