获取网站的信息

来源:互联网 发布:网络真人赌博合成视频 编辑:程序博客网 时间:2024/05/01 11:05

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

          
            System.Net.WebClient client = new WebClient();

//对于for循环是获取多少天数据,
            for (int i = 1; i <= 10; i++)
            {
                byte[] page = client.DownloadData("哪个网站"+i+"_0.html");
                string content = System.Text.Encoding.UTF8.GetString(page);
                string regex = "<table[^>]*?>[//s//S]*?</table>";           
                Regex re = new Regex(regex);
                MatchCollection matches = re.Matches(content);
                System.Collections.IEnumerator enu = matches.GetEnumerator();
                while (enu.MoveNext() && enu.Current != null)
                {
                    Match match = (Match)(enu.Current);
                    Response.Write("<html>");
                    Response.Write("<head></head>");
                    Response.Write("<body style=background-color:#EDF1F5>");
                    Response.Write(match.Value );
                    Response.Write("</body>"+ "/r/n");
                    Response.Write("</html>");

                }
            }
        }
    }