|
private void button4_Click(object sender, EventArgs e)
{
string Cookies = "";
string[] tem;
HttpHelper http = new HttpHelper();
HttpResult result = null;
//登陆
HttpItem item = new HttpItem()
{
Encoding = null,
URL = "http://bbs.mala.cn/member.php?mod=logging&action=login&infloat=yes&handlekey=login&inajax=1&ajaxtarget=fwin_content_login",
Method = "GET",
Cookie = "",
Referer="http://bbs.mala.cn/thread-8100622-1-1.html",
};
result = http.GetHtml(item);
Cookies = result.Cookie;
//
item = new HttpItem()
{
URL = "http://bbs.mala.cn/member.php?mod=logging&action=login&loginsubmit=yes&handlekey=login&loginhash=LN5TO&inajax=1",
Method = "POST",
Cookie = Cookies,
Postdata = "formhash=71098483&referer=http%3A%2F%2Fbbs.mala.cn%2Fthread-8100622-1-1.html&username=%CB%D0%CA%AB%CE%C5%B9%FA%D5%FE&password=amwww80963&questionid=0&answer=&loginsubmit=true",
Referer = "http://bbs.mala.cn/thread-8100622-1-1.html",
};
result = http.GetHtml(item);
Cookies += result.Cookie;
//登陆成功,如果再想打开社区的某个网页就不行了
item = new HttpItem()
{
Encoding = null,
URL = "http://bbs.mala.cn/thread-8100622-1-1.html",
Method = "GET",
Cookie = Cookies,
Referer = "http://bbs.mala.cn/thread-8100622-1-1.html",
};
result = http.GetHtml(item);
Cookies = result.Cookie;
webBrowser1.DocumentText = result.Html; //返回退出状态了
}
|
|