Httpwebrequest抓取页面数据
webbrower

解决方案 »

  1.   

    using System.IO;
    using System.Net;/// <summary>
    /// api 的摘要说明
    /// </summary>
    public class api
    {
    public api()
    {
    //
    // TODO: 在此处添加构造函数逻辑
    //
    }
        public static string GetStringByUrl(string url)
        {        HttpWebRequest hr = (HttpWebRequest)WebRequest.Create(url );
            hr.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
            hr.Method = "GET";
            hr.Timeout = 30 * 60 * 1000;
            WebResponse wr = hr.GetResponse();
            Stream str = wr.GetResponseStream();
            StreamReader sr = new StreamReader(str);
            string ssss = sr.ReadToEnd();
            sr.Close();
            str.Close();
            return ssss.Trim();
        }
    }给你,传递url,返回网页的string
      

  2.   

    在做小偷程序?
    http://www.jjlianmeng.com/ 这个就是偷得百姓的数据
      

  3.   

    用WebClient 的DownloadString 
    然后用正则表达式 关键字匹配