zoukankan      html  css  js  c++  java
  • winform获取网页代码的两种方式:

    1.使用WebClient类获取:

       1:  WebClient wc1 = new WebClient();
       2:  wc1.Encoding = Encoding.UTF8;
       3:   string weatherData1 = wc2.DownloadString(http://www.weather.com.cn/data/sk/101280601.html);

    2.使用网页流:

       1:              HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://www.weather.com.cn/data/sk/101280601.html");
       2:              request.Timeout = 5000;
       3:              request.Method = "GET";
       4:              HttpWebResponse response = (HttpWebResponse)request.GetResponse();
       5:              StreamReader sr = new StreamReader(response.GetResponseStream());
       6:              string jsonstr = sr.ReadLine();
  • 相关阅读:
    Winform使用ML.NET时无法加载 DLL“CpuMathNative”问题的解决方法
    离线安装nuget包EPPlus
    码云上webide怎么提交
    EXCEL中自定义格式输入的数据怎么完整复制
    远程桌面剪贴板不好用了
    电脑里明明安装了net4.7但是VS里不显示?
    微信公众号里的音频怎么下载
    Hibernate-ORM:06.Hibernate中三种状态
    Hibernate-ORM:05.Hibernate中的list()和iterator()
    Hibernate-ORM:04.Hibernate中的get()和load()
  • 原文地址:https://www.cnblogs.com/ilooking/p/3642164.html
Copyright © 2011-2022 走看看