我要截取他人网站里面的部分代码怎么弄啊    类似 天气预报的。。

解决方案 »

  1.   

     js, 首先直接获取HTML代码 然后你需要什么 就从中取得,用 divName.innerhtml方式,这只是一个思路
      

  2.   

            private String Gethtml(string url)
            {
                string pageData;
                WebClient wc = new WebClient();
                wc.Credentials = CredentialCache.DefaultCredentials;
                try
                {
                    Byte[] byres = wc.DownloadData(url);
                    pageData = System.Text.Encoding.Default.GetString(byres);
                    wc.Dispose();
                    return pageData;
                }
                catch
                {
                    wc.Dispose();
                    return "";
                }
            }这是获取怎个页面的原代码,要截取只要用substring就可以了
      

  3.   

    编码转换
    StreamReader reader = new StreamReader(stream, Encoding.GetEncoding("gb2312"))