日期:2014-05-18 浏览次数:20560 次
/// <summary> /// 根据ulr读出html /// </summary> static string GetHtml(string url) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream stream = response.GetResponseStream(); StreamReader sReader = new StreamReader(stream, Encoding.Default); string html = sReader.ReadToEnd().Replace("\r\n", ""); response.Close(); Console.WriteLine(html); return html; }