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();
  • 相关阅读:
    supervise 用来监控服务,自动启动
    tee -a /var/log/jd.log
    类的构造函数与析构函数的调用顺序
    c++之带默认形参值的函数
    zoj1001-A + B Problem
    zoj1037-Gridland
    cf499A-Watching a movie
    cf478B-Random Teams 【排列组合】
    C++版修真小说
    Python_12-线程编程
  • 原文地址:https://www.cnblogs.com/ilooking/p/3642164.html
Copyright © 2011-2022 走看看