Step by step, sure to succeed Httphelper class please search from the Web
String postdata = Getpostdata ();
Httphelper ht = new Httphelper ();
Httpitem item = new Httpitem ()
{
URL = "Https://account.xiaomi.com/pass/serviceLoginAuth2",
Method = "POST",
PostData = PostData,
Cookiecontainer = new System.Net.CookieContainer (),
ContentType = new Miloginhttphelper (). ContentType,
};
String html = Ht. Gethtml (item). Html;
Method: Getpostdata ()
private String Getpostdata ()
{
String name = TxtUName.Text.Trim ();
string pwd = TxtPwd.Text.Trim ();
Postparapair model = new Postparapair ();
Model. ADD (New Postparapair () {Key = "_sign", Value = "r4crs0jl2jfhhapenjpg2c3foa4="});
Model. ADD (New Postparapair () {Key = "callback", Value = "Https://account.xiaomi.com/sts?sign=6aRtWvCpNNuCwNpKtdu9CEEJOL8%3D &followup=https%3a%2f%2faccount.xiaomi.com%2fpass%2fuserinfo&sid=passport "});
Model. ADD (New Postparapair () {Key = "qs", Value = "%3fcallback%3dhttps%253a%252f%252faccount.xiaomi.com%252fsts%253fsign% 253d6artwvcpnnucwnpktdu9ceejol8%25253d%2526followup%253dhttps%25253a%25252f%25252faccount.xiaomi.com% 25252fpass%25252fuserinfo%2526sid%253dpassport%26sid%3dpassport "});
Model. ADD (New Postparapair () {Key = "pwd", Value = pwd});
Model. ADD (New Postparapair () {Key = "Serviceparam", Value = "{\" checksafephone\ ": false}"});
Model. ADD (New Postparapair () {Key = "Sid", Value = "Passport"});
Model. ADD (New Postparapair () {Key = "user", Value = name});
return model. ToString ();
}
Class Postparapair:
public class Postparapair
{
list<postparapair> paralist = new list<postparapair> ();
public string Key {get; set;}
public string Value {get; set;}
public void Add (Postparapair para)
{
Paralist.add (para);
}
public override string ToString ()
{
String restring = "";
if (Paralist.count! = 0)
{
foreach (Postparapair item in paralist)
{
Restring + = string. Format ("&{0}={1}", item. Key, Commonmethod.geturlencode (item. Value));
}
}
Return Restring.trimstart (' & ');
}
}
Commonmethod.geturlencode: Method
public static string Geturlencode (string content)
{
Return System.Web.HttpUtility.UrlEncode (content, System.Text.Encoding.UTF8);
}
Xiaomi Website Login Source C # version