- Регистрация
- 17.02.2021
- Сообщения
- 2
- Благодарностей
- 0
- Баллы
- 1
This is a question about the Cloud, as I cannot find any type of useful information online. Sorry to post here, but didn't see anywhere else to seek support.
It says that the Cloud works with RuCaptcha (Russian 2Captcha) and a few others. I do not speak Russian and am loading an en-US domain for what I need this for. Could you tell me why the API Key is not being read? Code is below and yes I've looked through everything and searched all over the internet. Only to come up empty-handed...
It says that the Cloud works with RuCaptcha (Russian 2Captcha) and a few others. I do not speak Russian and am loading an en-US domain for what I need this for. Could you tell me why the API Key is not being read? Code is below and yes I've looked through everything and searched all over the internet. Only to come up empty-handed...
C#:
private bool SolveRecaptchaV2(string googleKey, string pageUrl, out string result)
{
string requestUrl = "http://2captcha.com/in.php?key=" + txtCreator2CaptchaKey.Text + "&method=userrecaptcha&googlekey=" + googleKey + "&pageurl=" + pageUrl;
try
{
WebRequest req = WebRequest.Create(requestUrl);
using (WebResponse resp = req.GetResponse())
using (StreamReader read = new StreamReader(resp.GetResponseStream()))
{
string response = read.ReadToEnd();
if (response.Count() < 3)
{
result = response;
return false;
}
else
{
if (response.Substring(0, 3) == "OK|")
{
string captchaID = response.Remove(0, 3);
for (int i = 0; i < 24; i++)
{
WebRequest getAnswer = WebRequest.Create("http://2captcha.com/res.php?key=" + txtCreator2CaptchaKey.Text + "&action=get&id=" + captchaID);
using (WebResponse answerResp = getAnswer.GetResponse())
using (StreamReader answerStream = new StreamReader(answerResp.GetResponseStream()))
{
string answerResponse = answerStream.ReadToEnd();
if (answerResponse.Count() < 3)
{
result = answerResponse;
return false;
}
else
{
if (answerResponse.Substring(0, 3) == "OK|")
{
result = answerResponse.Remove(0, 3);
return true;
}
else if (answerResponse != "CAPCHA_NOT_READY")
{
result = answerResponse;
return false;
}
}
}
Thread.Sleep(5000);
}
result = "Timeout";
return false;
}
else
{
result = response;
return false;
}
}
}
}
catch { }
result = "Unknown error";
return false;
}