venerdì 26 ottobre 2012

Getting Data From a Web Page

Sometimes could be usefull get values from web pages. 
The following code show how to achieve this scope.


WebBrowser web_browser = new WebBrowser();
web_browser.Url = new Uri("the url of the page you need to get data");
string data = web_browser.Document.GetElementById("ID of the element containing the data you need*").GetAttribute("the name of the attribute of the element **").ToString();

* you can take the ID viewing the html code of the page
** for example "value"


My Two Cents...

Nessun commento:

Posta un commento