老是提示验证码错误,这我朋友给的代码,,估计今年改了就不行了 兄弟们帮忙看下啊
[C#] 纯文本查看 复制代码 TaobaoLoginInfo loginInfo = param as TaobaoLoginInfo;
HttpRequest request = new HttpRequest();
HttpResponse response = null;
request.Url = "https://login.taobao.com/member/login.jhtml";
request.Method = "POST";
request.PostDataCharset = "UTF-8";
request.Referer = "https://www.taobao.com/";
request.AddParam("TPL_username", loginInfo.UserName);
request.AddParam("TPL_password", loginInfo.Password);
if (loginInfo.CheckCode != null)
{
request.AddParam("TPL_checkcode", loginInfo.CheckCode);
request.AddParam("need_check_code", "true");
if (CheckCodePanel.Visible && CheckCodePanel.Tag != null)
{
CookieContainer cc=new CookieContainer();
cc.Add(new Uri(request.Url), (CookieCollection)CheckCodePanel.Tag);
request.Cookies = cc;
}
}
request.AddParam("loginType", loginInfo.LoginType + "");
request.AddParam("callback", "1");
response=HttpUtil.GetHtml(request);
String json = response.Html;
JavaScriptObject jsonObj = (JavaScriptObject)JavaScriptConvert.DeserializeObject(json);
bool state = (bool)jsonObj["state"];
if (state)
{
//登陆成功
App.UpdateUI(this, _RefreshUI, new Object[] { "登陆成功!", json, response.Cookies != null ? response.Cookies.GetCookies(new Uri(request.Url)) : null });
App.UpdateUI(this, _AccessTaobaoHomePageAfterLoginOk);
}
else
{
String msg = jsonObj["message"] as String;
JavaScriptObject jsonSubObj = jsonObj["data"] as JavaScriptObject;
int stateCode = int.Parse(jsonSubObj["code"].ToString());
App.UpdateUI(this, _RefreshUI, new Object[] { msg, json, response.Cookies!=null?response.Cookies.GetCookies(new Uri(request.Url)):null });
{
App.UpdateUI(this, _RefershCheckCode, new Object[] { stateCode });
}
}
Com.YibaiSoft.Tools.rar
(279.62 KB, 下载次数: 49)
|