0

有下载页面的代码:

 System.Net.WebClient client = new System.Net.WebClient();
 client.Headers.Add("user-agent", "Mozilla/20.0.1");
 byte[] feedBytes;
 string url;
 url = @"http://www.marathonbet.co.uk/en/betting/Football";
 string fullPage = string.Empty;
 try
 {
      feedBytes = client.DownloadData(url);
 }
 catch (System.Net.WebException)
 {
      return;
 }
string fullPage = Encoding.UTF8.GetString(feedBytes);

结果“fullpage”仅包含页面的一部分。在浏览器中页面的加载是逐渐发生的。如何下载整页?

4

1 回答 1

0

尝试这个

public static string GetHTMLDocument(string url)
        {
            var result = "";
            using (var wc = new WebClient())
            {
                result = wc.DownloadString(url);
            }
            return result;
        }
于 2013-06-04T20:01:28.063 回答