拥有下载页面的代码:
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'仅包含页面的一部分。在浏览器中,页面的加载逐渐发生。如何下载整页?
答案 0 :(得分:0)
试试这个
public static string GetHTMLDocument(string url)
{
var result = "";
using (var wc = new WebClient())
{
result = wc.DownloadString(url);
}
return result;
}