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();
  • 相关阅读:
    python 安装预编译库注意事项-pip
    Lucene 入门需要了解的东西
    PHPSTORM 与 Xdebug 配合调试
    Windows 下命令行修改文件夹的控制权限 Cacls
    PHP 解压zip文件的函数封装
    PHP 关于回调的用法
    CentOS7 安装 swoole
    CentOS7 安装 scala 2.11.1
    PHP 代码质量检测工具的安装与使用
    PHP 新建动态类的代码
  • 原文地址:https://www.cnblogs.com/ilooking/p/3642164.html
Copyright © 2011-2022 走看看