using System;
using System.Net;
using System.Text;
using System.IO;
class Test {
[STAThread]
public static void Main(string[] args) {
Uri uri = new Uri("http://www.apache.org");
WebRequest wr = WebRequest.Create(uri);
Stream s = wr.GetResponse().GetResponseStream();
StreamReader sr = new StreamReader(s, Encoding.Default);
Console.WriteLine(sr.ReadToEnd());
sr.Close();
s.Close();
Console.ReadLine();
}
}
获取网页内容
80酷酷网 80kuku.com