只要定义了固定的方法就有了局限性,我这里只你不配置全部是安Http协议的默认值 的,比如Get
[C#] 纯文本查看 复制代码 HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem() { URL = "http://www.sufeinet.com"};
HttpResult result = http.GetHtml(item);
string html = result.Html;
string cookie = result.Cookie;
只需要这样就行了,
Post也很简单
[C#] 纯文本查看 复制代码 HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://www.sufeinet.com",
Method = "post",
Postdata = "username=sufei&pwd=sufeinet.com"
};
HttpResult result = http.GetHtml(item);
string html = result.Html;
string cookie = result.Cookie;
这样已经够简单了吧,我走的是对象法,不能倒退到重载方法的方式,这点希望理解吧。
|