飞哥,我把参数全加上,还是不行啊。这倒底是为什么啊?
帮帮忙,指点一下啊。
[C#] 纯文本查看 复制代码 //跳转到登陆页面
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "https://account.server.nubia.cn/profile/login",//URL这里都是测试 必需项
Method = "GET",//URL 可选项 默认为Get
Host="account.server.nubia.cn",
KeepAlive=true,
Accept = "text/html, application/xhtml+xml, */*",
UserAgent="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)",
Allowautoredirect=true
};
//得到HTML代码
HttpResult result = http.GetHtml(item);
StreamWriter test = new StreamWriter("D:\\test.txt");
test.Write(result.Cookie);
test.Close();
Regex regexForm_Tag = new Regex("<input type=\"hidden\" name=\"form_tag\" id=\"form_tag\" value=\"(?<UidStr>.*?)\">", RegexOptions.Compiled);
Match Form_Tag = regexForm_Tag.Match(result.Html);
string Form_Tag_Str = Form_Tag.Groups[1].ToString();
string PostStr = "form_tag=" + Form_Tag_Str + "&username=" + userName + "&password=" + userPWD + "&back_url=https://account.server.nubia.cn/profile/";
//form_tag=30b170235eca93fef7101b6e1897c04e&username=79035684%40qq.com&password=yy7802505&back_url=https://account.server.nubia.cn/profile/
item = new HttpItem()
{
URL = "https://account.server.nubia.cn/profile/ajax_do_login",//URL这里都是测试URl 必需项
Method = "POST",//URL 可选项 默认为Get
Host="account.server.nubia.cn",
KeepAlive=true,
Accept="*/*",
ContentType="application/x-www-form-urlencoded; charset=UTF-8",
UserAgent="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)",
Postdata = PostStr,
Referer = "https://account.server.nubia.cn/profile/login",
Allowautoredirect=true
};
//得到新的HTML代码
result = http.GetHtml(item);
test = new StreamWriter("D:\\test.txt");
test.Write(result.Cookie);
test.Close();
|