static void Main(string[] args) { WebRequest wrq = WebRequest.Create("http://www.baidu.com"); WebResponse wrs = wrq.GetResponse(); Stream strm = wrs.GetResponseStream(); StreamReader sr = new StreamReader(strm); string line; while ((line = sr.ReadLine()) != null) { Console.WriteLine(line); } Console.Read(); strm.Close(); }
时间: 2024-11-05 16:10:36