|
代码很简单,就get第一个页面,然后post第二个页面
实现登录小米账号。
返回的结果也算正确了一半。
正常网页抓包的结果是
POST https://account.xiaomi.com/pass/serviceLoginAuth2 这页面以后 302定向到
http://account.xiaomi.com/pass/userInfo?userId=30856247 就显示登录成功的信息了。
我用别的httphelper 就这么POST 以后 就可以得到和抓包成功 类似的信息。 而sufeihelper好像就卡住了。
private void button1_Click(object sender, EventArgs e)
{
HttpHelper helper = new HttpHelper();
HttpItem item1 = new HttpItem()
{
URL = "https://account.xiaomi.com/pass/serviceLogin",
};
HttpResult result1 = helper.GetHtml(item1);
Regex regex1 = new Regex("(?<=sign\" value=\").*?(?=\")");
string matchSign = HttpUtility.UrlEncode(regex1.Match(result1.Html).ToString().Trim());
string postdata = "passToken=&user=" + HttpUtility.UrlEncode("crlg26x5yh@jay520.net") + "&pwd=jia123456&callback=https%3A%2F%2Faccount.xiaomi.com&sid=passport&qs=%253Fsid%253Dpassport&hidden=&_sign=" + matchSign;
HttpItem item2 = new HttpItem()
{
URL = "https://account.xiaomi.com/pass/serviceLoginAuth2",
Encoding = Encoding.UTF8,
Method = "Post",
Postdata = postdata,
ContentType = "application/x-www-form-urlencoded",
Allowautoredirect = true,
Referer = "https://account.xiaomi.com/pass/serviceLogin",
};
HttpResult result2 = helper.GetHtml(item2);
}
|
|