zoukankan      html  css  js  c++  java
  • 获取url的字符串数据

      public string GetHttpData(string sUrl)
            {
                string sRslt = null;
                WebResponse oWebRps = null;
                WebRequest oWebRqst = WebRequest.Create(sUrl);
                oWebRqst.Timeout = 50000;
                try
                {
                    oWebRps = oWebRqst.GetResponse();
                }          
            
                finally
                {
                    if (oWebRps != null)
                    {
                        StreamReader oStreamRd = new StreamReader(oWebRps.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"));
                        sRslt = oStreamRd.ReadToEnd();
                        oStreamRd.Close();
                        oWebRps.Close();
                    }
                }
                return sRslt;
            }
  • 相关阅读:
    Beta冲刺(4/4)
    2019 SDN上机第7次作业
    Beta冲刺(3/4)
    Beta冲刺(2/4)
    机器学习第二次作业
    机器学习第一次作业
    软工实践个人总结
    第04组 Beta版本演示
    第04组 Beta冲刺(5/5)
    第04组 Beta冲刺(4/5)
  • 原文地址:https://www.cnblogs.com/bestsaler/p/1835829.html
Copyright © 2011-2022 走看看