C# 2 2captcha图像发布
HttpClient client = new HttpClient();
var bytes = File.ReadAllBytes("sample.jpg");
var base64 = Convert.ToBase64String(bytes);
var secretKey = "8ffa...";
var url = "https://2captcha.com/in.php?key=" + secretKey;
using ( client = new HttpClient())
{
var content = new StringContent(base64);
var response = await client.PostAsync(url , content);
var stringResponse = await response.Content.ReadAsStringAsync();
Console.WriteLine(stringResponse);
Console.ReadLine();我的每一个回应都是ERROR_ZERO_CAPTCHA_FILESIZE,我不知道问题出在哪里。
发布于 2020-02-18 11:35:32
ERROR_ZERO_CAPTCHA_FILESIZE意味着图像大小小于100个字节(而不是千字节)。您需要彻底检查是否正确地发送图像。下面是一个适当的Base64示例表单的示例:
<form method="post" action="https://2captcha.com/in.php">
<input type="hidden" name="method" value="base64">
<input type="text" name="key" value="YOUR_APIKEY">
<textarea name="body">BASE64_FILE</textarea>
<input type="submit" value="Upload and get the ID">
</form>也许问题在您的sample.jpg文件中。尝试将真实的captcha图片编码为base64 (实际上您可以在2 captcha登录页上获取一张)。您的base64文本字符串必须有一个图像文件的权重,因此它必须至少有几千字节。
https://stackoverflow.com/questions/60241285
复制相似问题