This major company needs to update the exchange rate every day for foreign trade. Previously there was a service that could be called, but that connection was useless, so I wrote something like this to capture the webpage display information.
Class ExchangeRate
{
Private const string _ BASEURL = "webpage address ";
Public const string CURRENCYCODE = "currency type separated by |"; // currency type
Public Hashtable GetValues ()
{
Hashtable htReturn = new Hashtable ();
String url = _ BASEURL; // + HttpUtility. UrlEncode (tmSet. ToString ("yyyy/MM/dd", DateTimeFormatInfo. InvariantInfo ));
WebClient wc = new WebClient ();
String sHtml = wc. DownloadString (url );
String sXml = string. Empty;
Int iValueCnt = CURRENCYCODE. Split (new char [] {|}, 10, StringSplitOptions. RemoveEmptyEntries). Length;
String [] sTBody = sHtml. Split (new string [] {"<tbody>", "</tbody>"}, StringSplitOptions. RemoveEmptyEntries );
Foreach (string ss in sTBody)
{
If (ss. Contains ("Currency Name "))
{
String [] sbrs = ss. Split (new string [] {"</tr>"}, StringSplitOptions. RemoveEmptyEntries );
Foreach (string sbr in sbrs)
{
String scur = string. Empty;
Double dRate =