[C#] 纯文本查看 复制代码 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DotNet.Utilities;
using System.Text.RegularExpressions;
namespace xiaomilogin
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string username =textBox1.Text.Trim();//
string password =textBox2.Text.Trim();
string Cookies = "";//
HttpItem itemSign = new HttpItem() //获取_sign
{
URL = "https://account.xiaomi.com/pass/serviceLogin",
};
HttpHelper http = new HttpHelper();
HttpResult httpresult = http.GetHtml(itemSign);
Cookies = httpresult.Cookie;
string FrameSrc = System.Uri.EscapeDataString(Regex.Match(httpresult.Html, "(?<=var iframeSrc = \").*\"").Value.ToString().Replace("\"", ""));
HttpItem item = new HttpItem() //登陆Post
{
URL = "https://account.xiaomi.com/pass/serviceLoginAuth2",
Method = "POST",
Referer = "https://account.xiaomi.com/pass/serviceLogin",
ContentType = "application/x-www-form-urlencoded",
Postdata = string.Format("passToken={0}&user={1}&pwd={2}&callback={3}&sid={4}&qs={5}&hidden={6}&_sign={7}", "", username, password, CallBack, SID, QS, HIDDEN, SIGN)
};
HttpResult result = http.GetHtml(item);
richTextBox1.Text = result.Html;
}
}
}
想要源码的可以到我的商店购买http://www.sufeinet.com/thread-8276-1-1.html
这个能正常登录小米账户
并获取Cookie值。
大家可以直接拿去用,
这是在解决这个问题
http://www.sufeinet.com/thread-7582-1-1.html
时写的,我贴出来是方便大家使用
|