[C#] 纯文本查看 复制代码 第一步 item.Method = "post";
item.URL = "https://login.taobao.com/member/request_nick_check.do?_input_charset=UTF-8&username=" + HttpUtility.UrlEncode(userName);
HttpResult resultCode = m_Http.GetHtml(item);
cookies = resultCode.Cookie;//得到cookie
var bRtn = resultCode.Html.Contains("needcode\":t");
第二步 显示验证码(用到第一步的cookie)
picVcode.ImageLocation = "https://regcheckcode.taobao.com/auction/checkcode?sessionID=" + cookies + "&rad=0.07491354105764925&_r_=" + DateTime.Now.ToString("yyyymmddfffff");
第三步 提交验证
item.URL = "https://login.taobao.com/member/login.jhtml";//URL 必需项
item.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";//返回类型 可选项有默认值
item.Method = "post";//URL 可选项 默认为Get
item.Postdata = string.Format("TPL_username={0}&TPL_password={1}&TPL_checkcode={2}&need_check_code=true&callback=1&newlogin=1",
HttpUtility.UrlEncode(txtLoginId.Text.Trim()),
HttpUtility.UrlEncode(txtPwd.Text.Trim()),
HttpUtility.UrlEncode(txtVcode.Text.Trim()));//Post数据 可选项GET时不需要写
item.Cookie = cookies;
HttpResult result = m_Http.GetHtml(item);
string html = result.Html;
现在一直报验证码错误,不知道怎么回事,有谁遇到过吗?
|