I've never done web crawling or web-scraping. But now I need to read and download specific data from a forex url and store into database for further data evaluation by developing a automated robot developed in C#. I'm reading the website using the following code:
public static string GetPage(string url)
{
try
{
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse resp = (HttpWebResponse)wr.GetResponse();
Stream s = resp.GetResponseStream();
StreamReader tr = new StreamReader(s, Encoding.ASCII);
string html = tr.ReadToEnd();
tr.Close();
s.Close();
return html;
}
catch (Exception ex)
{
throw new ApplicationException("Error downloading web page " + url.ToString(), ex);
}
}
But the above code is giving me the whole HTML code for the page where as I need to get the EURO to GBP, USD and CHF conversion rate reading but nothing else. Please refer to the below image for the details:
Now please advice me how do I read those specific data? Is there any proper way to do that or do I need to find it from the HTML extract? Thanks.