public class Program
{
public static void Main(string[] args)
{
RequestData("http://www.baidu.com");
Console.ReadLine();
}
public static async void RequestData(string uri)
{
HttpWebRequest httpWebRequest = WebRequest.CreateHttp(uri);
WebResponse webResponse =await httpWebRequest.GetResponseAsync();
Stream stream = webResponse.GetResponseStream();
StreamReader sr = new StreamReader(stream, System.Text.Encoding.UTF8);
Console.Write(sr.ReadToEnd());
}
}
HttpWebRequest && WebResponse
最新推荐文章于 2024-08-27 14:45:25 发布