Created
July 8, 2011 12:31
-
-
Save fjeldstad/1071730 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static HtmlDocument GetHtmlDocument(string url) | |
{ | |
var page = new HtmlDocument | |
{ | |
OptionOutputAsXml = true | |
}; | |
HtmlNode.ElementsFlags.Remove("option"); | |
// Fetch and load HTML document (default gym selected) | |
var request = (HttpWebRequest)HttpWebRequest.Create(url); | |
request.UserAgent = UserAgent; | |
var response = (HttpWebResponse)request.GetResponse(); | |
using (var reader = new StreamReader(response.GetResponseStream(), true)) | |
{ | |
page.LoadHtml(reader.ReadToEnd()); | |
} | |
return page; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment