Friday 12 September 2008

Scrapping data using C#

Found an interesting article about screen scrapping here. Didn't think it was that easy. Here is some C# code that gets google's homepage data.

WebClient webClient = new WebClient();
string url = "http://www.google.com";
byte[] dataArray = webClient.DownloadData(url);
UTF8Encoding encoding = new UTF8Encoding();
string data = encoding.GetString(dataArray);


Once you have the data string you can do your own parsing to use the data.

No comments: