| You can easily get the HTML of the page in a string variable. That html can be of a page such as yahoo.com or any other page. You only need to use the WebClient class which is in System.Net. Here is the code which retrieves the HTML of the currently running page: protected void Button1_Click(object sender, EventArgs e) { WebClient myClient = new WebClient(); string myPageHTML = null; byte[] requestHTML; // Gets the url of the page string currentPageUrl = Request.Url.ToString();
UTF8Encoding utf8 = new UTF8Encoding(); // by setting currentPageUrl to www.yahoo.com it will fetch the source (html) // of the yahoo.com and put it in the myPageHTML variable.
// currentPageUrl = "http://www.yahoo.com"; requestHTML = myClient.DownloadData(currentPageUrl);
myPageHTML = utf8.GetString(requestHTML); Response.Write(myPageHTML); }
The good thing is that you can use the regular expressions on the HTML to extract the pieces that you want. powered by IMHO |
Print | posted @ Monday, October 24, 2005 9:20 PM