一巷查,批量識別抹腿,批量報錯
1.提交get請求岛请,使用Json方法獲取gid(驗證碼的身份證明)
注意:請求url中有count=i幢踏,自增型變量(使用for循環(huán)的i進行匹配)
string httpResult = GetPic.HttpGet("https://store.steampowered.com/join/refreshcaptcha/?count=", i.ToString());
2.用得到的gid髓需,拼接圖片下載地址
string PicUrl = "https://store.steampowered.com/public/captcha.php?gid=" + m_result;
3.使用get請求房蝉,獲取圖片Stream流微渠,使用GetBytes方法將其轉換為二進制格式搭幻,存入變量
Stream httpResult1 = GetPic.HttpGetPic(PicUrl, "");
byte[] bs = GetPic.GetBytes(httpResult1);
4.上傳至打碼平臺識別(二進制上傳方式)逞盆,解析并處理返回的字符串檀蹋,提取答案與答題ID
string httpResult2 = RKHTTp.Post("http://api.ruokuai.com/create.json", param, bs);
5.使用答案提交表單
string httpResult3 = GetPic.HttpGet("https://store.steampowered.com/join/verifycaptcha/?captchagid=" + m_result + "&captcha_text=" + m_AnResult + "&email=1318733145%40qq.com&count=" + i.ToString(), "");
注意:需要提交的其他信息位email(使用固定地址)與count次數(使用for循環(huán)的i)云芦。
6.解析返回的Json字符串俯逾,提取匹配結果
string AnResultCk = jo2["bCaptchaMatches"].ToString();//驗證碼答案是否正確
string AnResultCk1 = jo2["bEmailAvail"].ToString();//郵箱是否有效
7.根據結果判斷舅逸,如錯誤則提交報錯桌肴,正確則進行下輪循環(huán)
if (AnResultCk == "false")? ? ? ? ? ? ? ? ? ?
?{? ? ? ? ? ? ? ? ? ? ? ??
//提交報錯? ? ? ? ? ? ? ? ? ? ? ??
var param1 = new Dictionary{
{"username","forsek"},
{"password","sabar777"},
{"id",m_AnId}
};
string httpResult4 = RKHTTp.Post("http://api.ruokuai.com/reporterror.xml", param1);