|
本帖最后由 ffww 于 2014-2-27 00:34 编辑
private void button4_Click_1(object sender, EventArgs e)
{
string Cookies = "";
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
Encoding = null,
ContentType = "application/x-www-form-urlencoded",
URL = "http://tt.mop.com/read_14630914_0_0.html",//URL这里都是测试 必需项
Method = "get",//URL 可选项 默认为Get
};
//得到HTML代码
HttpResult result = http.GetHtml(item);
item = new HttpItem()
{
URL = "http://passport.mop.com/Login?url=http://tt.mop.com/read_14630914_0_0.html",//URL这里都是测试URl 必需项
Encoding = null,
ContentType = "application/x-www-form-urlencoded",
Method = "post",//URL 可选项 默认为Get
Cookie = result.Cookie,
Postdata = "user_name=%CE%E0%CD%A9%D2%B9%D4%C2&password=123123",
Referer = "http://tt.mop.com/read_14630914_0_0.html",
};
//得到新的HTML代码
result = http.GetHtml(item); //显示 The URL has Moved here
//转向
//得到HTML代码
item = new HttpItem()
{
URL = "http://tt.mop.com/read_14630914_0_0.html",//URL这里都是测试URl 必需项
Encoding = null,
ContentType = "application/x-www-form-urlencoded",
Method = "get",//URL 可选项 默认为Get
Cookie = result.Cookie,
Referer = "http://tt.mop.com/read_14630914_0_0.html",
};
result = http.GetHtml(item); //又退出了,没登陆上
webBrowser1.DocumentText = result.Html;
return;
}
估计是cookie问题,不用字符串cookie,用CookieCollection也不行,我直晕了.........
|
|