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();
  • 相关阅读:
    hdu1754线段树入门
    hdu1247 字典树模板
    完全背包 poj 1384
    hdu 1541 树状数入门
    hdu 2665 划分树模板
    winhex分析磁盘目录结构(未完待续)
    取出表单中元素的js代码
    c语言检测cpu大小端模式
    firefox的cookie
    c移位实现求余
  • 原文地址:https://www.cnblogs.com/ilooking/p/3642164.html
Copyright © 2011-2022 走看看