标签:
private string getHtml(string url)
{
HttpItem item = new HttpItem()
{
URL = url,
Encoding = null,
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
KeepAlive = false,
UserAgent = userAgent,
Expect100Continue = true,
Header = new WebHeaderCollection()
{
{"Accept-Encoding","gzip, deflate"},
{"Accept-Language","zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"}
}
};
HttpResult result = http.GetHtml(item);
return result.Html;
}
private string postHtml(string url, string postData, string referer)
{
HttpItem item = new HttpItem()
{
URL = url,
Encoding = null,
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
KeepAlive = true,
ContentType = "application/x-www-form-urlencoded",
Referer = referer,
UserAgent = userAgent,
Expect100Continue = false,
Method = "POST",
Postdata = postData,
Header = new WebHeaderCollection()
{
{"Accept-Encoding","gzip, deflate"},
{"Accept-Language","zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"}
}
};
HttpResult result = http.GetHtml(item);
return result.Html;
}
标签:
原文地址:http://www.cnblogs.com/lopengye/p/5853292.html