用httpwebrequest抓取网页,然后用正则或者查找字符串分析
  
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) 最新版本:20070210http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html

解决方案 »

  1.   

    string url = "http://";
                        WebClient wb = new WebClient();                    byte[] pageData = wb.DownloadData(@url);                    //转换字符
                        string result = Encoding.Default.GetString(pageData);                    //替换内容
                        //string str = result.Replace("\"","");
                        //str=str.Replace("onclick=if(this.width>=700) window.open","").Replace("onload=if(this.width>'700')this.width='700';","").Replace("删除","").Replace("[","").Replace("]","").Replace("图片:","");
      

  2.   

    string ss = "<tr><td width=\"19%\">中小板ETF</td><td width=\"13%\">159902</td><td width=\"14%\" align=\"center\">2006-6-8</td><td width=\"16%\">华夏基金</td><td width=\"10%\" align=\"right\">40亿 </td><td width=\"14%\" align=\"right\">1.498 </td><td width=\"14%\" align=\"right\">1.498 </td></tr>";
    RegexOptions ss=RegexOptions.None;
    Regex rr=new Regex("<[^<>]+>",ss);
    可以得出表里的每项数据!
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace testf
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            private static bool CopyData(System.IO.Stream FromStream, System.IO.Stream ToStream)
            {
                try
                {
                    int intBytesRead;
                    const int intSize = 4096;
                    Byte[] bytes = new Byte[intSize];
                    intBytesRead = FromStream.Read(bytes, 0, intSize);
                    while (intBytesRead > 0)
                    {
                        ToStream.Write(bytes, 0, intBytesRead);
                        intBytesRead = FromStream.Read(bytes, 0, intSize);
                    }
                    return true;
                }
                catch (Exception myError)
                {              
                    return false;
                }        }
            public static bool DownloadFile(string remoteurl, System.IO.Stream Stream)
            {
                System.Net.WebRequest req;
                try
                {
                    req = System.Net.WebRequest.Create(remoteurl);
                    req.Method = "GET";
                    System.Net.WebResponse rsp = req.GetResponse();                return CopyData(rsp.GetResponseStream(), Stream);
                }
                catch (Exception myError)
                {
                    
                    return false;
                }
            }
            private void button1_Click(object sender, EventArgs e)
            {
                System.IO.MemoryStream ms=new System.IO.MemoryStream ();
                DownloadFile(@"http://www.ccb.com/portal/cn/finance_quote/fundnetvalueinfo.jsp", ms);
                int size = Convert.ToInt32(ms.Length);
                ms.Position = 0;
                Byte[] bytes = new Byte[size];
                ms.Read(bytes, 0, size);
                System.Text.Encoding  ed= System.Text.Encoding.GetEncoding("GB2312");
                string s = ed.GetString(bytes);
                MessageBox.Show(s);
                //自己分析 吧        }
        }
    }