当前位置:编程学习 > C#/ASP.NET >>

C# winfrom WebRequest获取html网页信息 引用using

private string GetHtmlinfo(string PageUrl)
        {
            WebRequest request = WebRequest.Create(PageUrl);
            WebResponse response = request.GetResponse();
            Stream resStream = response.GetResponseStream();
            StreamReader sr = new StreamReader(resStream, System.Text.Encoding.Default);
            string htmlinfo = sr.ReadToEnd();
            resStream.Close();
            sr.Close();
            return htmlinfo;
        }

摘自 Bychentufeiyang的专栏
补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,