HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://www.sufeinet.com",//URL 必需项
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
//Encoding = Encoding.Default,
Method = "get",//URL 可选项 默认为Get
};
item.Header.Add("测试Key1", "测试Value1");
item.Header.Add("测试Key2", "测试Value2");
//得到HTML代码
HttpResult result = http.GetHtml(item);
//取出返回的Cookie
string cookie = result.Cookie;
//返回的Html内容
string html = result.Html;
if (result.StatusCode == System.Net.HttpStatusCode.OK)
{
//表示访问成功,具体的大家就参考HttpStatusCode类
}
//表示StatusCode的文字说明与描述
string statusCodeDescription = result.StatusDescription;