能否通过ASP.net先自动访问某一网站,获取该页面上某处的数字(该数字实时变动,就好像是股票行情),获取数字后,再做一定的运算。

解决方案 »

  1.   

    你去解析那个页面,然后采用dom的方式遍历它的html标记,然后获取相应控件的值或属性(也就是你要的数字)
      

  2.   

    WebClient sHttpWebClinet = new WebClient();
                            byte[] str1 = sHttpWebClinet.DownloadData(uri);
                            string strWebText = System.Text.Encoding.Default.GetString(str1);
                            Int32 i1 = strWebText.IndexOf("<title>") + 7;
                            Int32 i2 = strWebText.IndexOf("</title>") - 1;
                            string title = strWebText.Substring(i1, i2 - i1);
    //获取<title>内容
      

  3.   

    大家不要见笑,我还是不懂。比如我要得到的数字是http://fund3.eastmoney.com/450003.html中的盘中估算净值,应该如何做?
      

  4.   

    httpwebrequest 请求页面,可以考虑用正则表达式去取你要的内容
      

  5.   


    http://www.51aspx.com/CV/HouseSpiderSystem/InsApp/WebSearch/Getword.cs.html
      

  6.   

    各位大哥帮我看看,我是新手呀,你们说的是很简单,可我不懂呀。
    我写的代码如下,我下载是下载了,但是里面(d:\123.txt)怎么找我要的数据?                        WebClient Client = new WebClient();
                Stream strm = Client.OpenRead("http://fund3.eastmoney.com/450003.html");
                StreamReader sr = new StreamReader(strm);
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    StreamWriter sw = new StreamWriter("d:\\123.txt", true, Encoding.GetEncoding("gb2312"));
                    sw.WriteLine(line);
                    sw.Close();
                }
                strm.Close();
      

  7.   

    请哪位高手再帮我看看呀,比如http://fund3.eastmoney.com/450003.html中我要获取的部分好像是图片。再还有,如果获取下来了数字,应该如何做呢?请给出详细点的步骤
      

  8.   

    哈哈,我来说两句,
    用Ajax,
    xmlHttpRequest 获取其源代码,然后用正则表达式取出你要的数据,我前面回复过一个主题,类似吧,你看了应该可以看懂的,http://topic.csdn.net/u/20071217/15/07cc8121-5fbd-44ef-bb42-30dca422dbe0.html4楼的回复你看看
      

  9.   

    WebClient,
    httpwebrequest 
    把它抓下来
      

  10.   

    1.httpwebrequest 
    2.正则
    这两个就行了
      

  11.   

    This is easy if you use the browser control.But the browser cannot be instantiated because the current thread is not in a single-threaded apartment,so you should use Microsoft HTML Object Library for your parser.Your must add a reference to the Microsoft HTML Object Library and use createDocumentFromUrl method.
      

  12.   

    using System.Net;
    using System.Text;
            WebClient wb = new WebClient(); 
            byte[] pagedata = wb.DownloadData(@url);
            //转换字符、 
            string result = Encoding.UTF8.GetString(pagedata);然后分析result
      

  13.   

    用Ajax, 
    xmlHttpRequest   获取其源代码,然后用正则表达式取出你要的数据,我前面回复过一个主题,类似吧,你看了应该可以看懂的, http://topic.csdn.net/u/20071217/15/07cc8121-5fbd-44ef-bb42-30dca422dbe0.html 4楼的回复你看看楼主,我在这里说得很清楚啊,正则中把<form 和/form>替换掉就行了,你又没说你的数字两边是什么相的标记,咋给你写啊
      

  14.   

    比如http://fund3.eastmoney.com/450003.html我想要的是左边估算图下面的:盘中估算净值后面的那个数字,
    我感觉好像是图片(不知是不是,我是新手,不知对不)
      

  15.   

    哦,谢谢raul了,但是如果我要下面一行的  前一日净值:1.7364元  这个数字呢