|
30金钱
string cookies = "";
string username = "zzlibrary";
string password = "py910828";
CookieCollection cookie = new CookieCollection();
HttpHelper http = new HttpHelper();
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
HttpItem item = new HttpItem()
{
URL = "https://sso.zxxk.com/login?service=http%3A%2F%2Fgw.open.zxxk.com%2Frouter%3F%24method%3Dxk.user.callback%26%24app_key%3Dc4ca4238a0b923820dcc509a6f75849b%26curl%3Dhttp%253A%252F%252Fwww.zxxk.com%252F",
Host = "sso.zxxk.com",
Referer = "http://www.zxxk.com/",
Method = "get",
ResultCookieType = ResultCookieType.CookieCollection,
};
HttpResult rs = http.GetHtml(item);
cookie = rs.CookieCollection;
htmlDoc.LoadHtml(rs.Html);
HtmlNodeCollection lts = htmlDoc.DocumentNode.SelectNodes("//input[@name='lt']");
HtmlNodeCollection executions = htmlDoc.DocumentNode.SelectNodes("//input[@name='execution']");
HtmlNode lt = lts[0];
HtmlNode execution = executions[0];
HttpItem item2 = new HttpItem()
{
URL = "https://sso.zxxk.com/login?service=http%3A%2F%2Fgw.open.zxxk.com%2Frouter%3F%24method%3Dxk.user.callback%26%24app_key%3Dc4ca4238a0b923820dcc509a6f75849b%26curl%3Dhttp%253A%252F%252Fwww.zxxk.com%252F",
Cookie = cookies,
Host = "sso.zxxk.com",
Referer = "https://sso.zxxk.com/login?service=http%3A%2F%2Fgw.open.zxxk.com%2Frouter%3F%24method%3Dxk.user.callback%26%24app_key%3Dc4ca4238a0b923820dcc509a6f75849b%26curl%3Dhttp%253A%252F%252Fwww.zxxk.com%252F",
ContentType = "application/x-www-form-urlencoded",
Method = "post",
Postdata = string.Format("username={0}&password={1}<={2}&execution={3}", username, password, lt.Attributes["value"].Value, execution.Attributes["value"].Value),
ResultCookieType = ResultCookieType.CookieCollection,
Allowautoredirect = true,
};
HttpResult rs2 = http.GetHtml(item2);
cookie = rs2.CookieCollection;
代码已贴上 到最后一步获取的cookie不对
|
|