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();
  • 相关阅读:
    问卷调查--来自20145320周岐浩
    第一次尝试编写java
    写在开始编写Java之前(2)——Java的环境
    写在开始编写Java之前(1)——Java的跨平台性
    一步一步实现JS拖拽插件
    序列图像三维重建 学习流水账
    linux配置虚拟机网络环境(老师要求的host-only)
    递归函数时间复杂度分析(转)
    什么是static?什么是final?
    复习java数据库操作的总结
  • 原文地址:https://www.cnblogs.com/ilooking/p/3642164.html
Copyright © 2011-2022 走看看