//创建Httphelper对象
HttpHelper http = new HttpHelper();
//创建Httphelper参数对象
HttpItem item = new HttpItem()
{
URL = "http://sufeinet.com",//URL 必需项
Allowautoredirect=true,//自动跳转
AutoRedirectCookie=true//是否自动处理Cookie
};
//请求的返回值对象
HttpResult result = http.GetHtml(item);
//获取请请求的Html
string html = result.Html;
//获取请求的Cookie
string cookie = result.Cookie;
//获取URL重定向时最后一次访问的URL
string ResponseUri = result.ResponseUri;
Allowautoredirect=true,//自动跳转
AutoRedirectCookie=true//是否自动处理Cookie
howzew 发表于 2015-3-7 11:18
再次赞一个,这个对于多次302并且每次cookie都在变的情况实在是太有用了!
另外,看教程使用的是string类 ...
if (item.ResultCookieType == ResultCookieType.String)
{
item.Cookie = result.Cookie;
}
else
{
item.CookieCollection = result.CookieCollection;
}
站长苏飞 发表于 2015-3-7 11:21
[mw_shl_code=csharp,true] if (item.ResultCookieType == ResultCookieType.String)
...
大法师 发表于 2015-12-4 21:55
AutoRedirectCookie=true//是否自动处理Cookie C#提示错误 1 “.HttpItem”并不包含“AutoRedirectCookie” ...
EasonZou 发表于 2017-12-4 10:03
我的httphelper类为什么没有这些方法呢
sufeinet 发表于 2017-12-4 10:10
类没法嵌入这么多帮助方法
这是框架里面的。http://httphelper.sufeinet.com/
一语成谶 发表于 2018-7-10 03:28
老大遇到307咋办?
欢迎光临 苏飞论坛 (http://www.sufeinet.com/) | Powered by Discuz! X3.4 |