/// <summary> /// 获取整个页面内容 /// </summary> /// <param name="url"></param> /// <returns></returns> public static string GetPage(string url,string type) { HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); Stream stream = webResponse.GetResponseStream(); string content = string.Empty; StreamReader reader = new StreamReader(stream, System.Text.Encoding.GetEncoding(type == "hz" ? "gb2312" : "utf-8")); //整个页面内容 content = reader.ReadToEnd(); reader.Close(); webResponse.Close(); return content; }