110,534
社区成员
发帖
与我相关
我的任务
分享
1:先请求一下官网
string refer = "http://passport.tiancity.com/login/login.aspx";
string html = RequestPage(refer, "GET", string.Empty, string.Empty, cookie);
验证是否需要验证码:
string url = "http://captcha.tiancity.com/CheckSwitch.ashx?jsoncallback=jsonp1404802761412&fid=104&uid=" + 用户名;
html = RequestPage(url, "GET", ”“, "utf-8", cookie, ”http://passport.tiancity.com/login/login.aspx“);
参数说明:
回调地址:string refer = "http://passport.tiancity.com/login/login.aspx";
请求方式:GET;
编码:UTF-8
url = string.Format("http://captcha.tiancity.com/client.ashx?fid=104&code=1&uid={0}&tid=4a297921b4f0c659e7e7f108d7962abb&rnd={1}", 用户名, rnd,);
RequestImage(url, ”http://passport.tiancity.com/login/login.aspx“, out image, cookie);
参数说明:
rnd为随机数,生成方式如下。
string rnd = (new Random().NextDouble() * 99999).ToString();
回调地址:string refer = "http://passport.tiancity.com/login/login.aspx";
string lastAddress = string.Empty;
string Url = "https://passport.tiancity.com/handler/GetMatrix.ashx?jsoncallback=jsonp1404959492357&id=" + 用户名;
string html = RequestPage(Url, "GET", string.Empty, "utf-8", ck, "http://passport.tiancity.com/login/login.aspx", out lastAddress);
jsonp1404876136440({code:199,mt:"",pk:"CAAA375F893C9ED5B396C40D4618D6C8E75ACF7E58B65EF337C3D3F37E5E51EAF1E2C19AE39A74401C5510EAC2F9C435B4DD1FEB797B71B3088F45FF132418C14652F2F30DC7421B140460C9AEB9A36898D16A52B8563CAFEE7AFDEF5297DC8B714FEB4F95581B902DD87B3B87256AADED94ACA3317EC2481866986AEC3F1753",pm:"010001",rsa:"True"})
Url = "https://passport.tiancity.com/Login.ashx?jsoncallback=jsonp1404802761413&FCQ={0}&cp={1}&st=&fl=";
参数说明:
此处就是让我十分蛋疼的地方。
fcq : ( 账号+密码+&mt=<=0)拼接成的字符串通过rsa加密后得到的加密字符串。加密方式见后面
cp:(验证码结果+GUID) GUID即为获取验证码时候的tid ,两者要保持一致。
st: 空
fl: 空
jsonp1381460129003({code:1,id:"账号",url:""})
code:1为登录成功;
code:4&2为验证码或密码错误;