|
[code=csharp]HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
UserAgent="Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20100101 Firefox/21.0",
ContentType = "application/x-www-form-urlencoded",
URL = "http://g5zu.com/data/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=LbvCy&inajax=1",
Method = "post",
Postdata = "formhash=87add38b&referer=http%3A%2F%2Fg5zu.com%2Fdata%2Fforum.php&loginfield=username&username=text&password=text&questionid=0&answer=",
};
HttpResult result = http.GetHtml(item);//这里返回的数据是登录成功的,但是返回的cookies却不能让下面一个操作继续,也就是说还需要重新登录了。。
item = new HttpItem()
{
UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20100101 Firefox/21.0",
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
URL = "http://g5zu.com/data/home.php?mod=space",
Cookie=result.Cookie,
};
string html = result.Html;[/code]
这个方法是看苏飞的一个列子写的,但是貌似返回的cookies有点问题。有很多path=/,这样的东西,求老大指点~
|
|