日期:2014-05-16 浏览次数:20417 次
public String GetHtml()
{
string url = "http://t.news.fx168.com/";
HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest;
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
using (Stream stream = response.GetResponseStream())
{
HtmlDocument doc = new HtmlDocument();
doc.Load(stream, System.Text.Encoding.UTF8);
HtmlNode node = doc.DocumentNode.SelectSingleNode("//div']");//XPath 语法解析网页数据
return node.InnerHtml;
}
}
}