<% DIM currcode, gbp,usd, chf, objXML, currencyLookup, cubes, cube, curName currcode = request.querystring("curr") if Len(currcode) = 0 Then currcode = 4 URL = "http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml" Set objXML = Server.CreateObject("MSXML2.DOMDocument") ' don't add version! let windows pick it objXML.setProperty "ServerHTTPRequest", True objXML.async = False objXML.Load(URL) Set currencyLookup = Server.CreateObject("Scripting.Dictionary") Set cubes = objXML.getElementsByTagName("Cube") 'Response.Write "Found " & cubes.Length & " cubes (not all are cubes with currency)
" For c = 0 To cubes.Length - 1 Set cube = cubes.Item(c) ' Response.Write cube.xml curName = Trim("" & cube.getAttribute("currency") ) curRate = Trim("" & cube.getAttribute("rate") ) If curName <> "" AND curRate <> "" Then 'Response.Write "adding " & curName & " :: " & curRate & "
" currencyLookup.Add curName, CDBL(curRate) End If Next ' now you can lookup any currency from that dictionary object thus: gbp = currencyLookup("GBP") usd = currencyLookup("USD") chf = currencyLookup("CHF") If Not (IsEmpty(gbp) OR IsEmpty(usd)) Then Select case currcode Case 1 amount1 = Round((3300 * gbp),0) amount2 = Round((4300 * gbp),0) amount3 = Round((5350 * gbp),0) amount4 = Round((6700 * gbp),0) amount5 = Round((5350 * gbp),0) amount6 = Round((4300 * gbp),0) amount7 = Round((3300 * gbp),0) cur_name = "GB Pounds" Case 2 amount1 = Round((3300 * usd),0) amount2 = Round((4300 * usd),0) amount3 = Round((5350 * usd),0) amount4 = Round((6700 * usd),0) amount5 = Round((5350 * usd),0) amount6 = Round((4300 * usd),0) amount7 = Round((3300 * usd),0) cur_name = "US Dollars" Case 3 amount1 = Round((3300 * chf),0) amount2 = Round((4300 * chf),0) amount3 = Round((5350 * chf),0) amount4 = Round((6700 * chf),0) amount5 = Round((5350 * chf),0) amount6 = Round((4300 * chf),0) amount7 = Round((3300 * chf),0) cur_name = "Swiss Francs" Case Else amount1 = 3450 amount2 = 4450 amount3 = 5350 amount4 = 5990 amount5 = 5350 amount6 = 4450 amount7 = 3450 cur_name = "Euro" End select End If %> Catamaran Yacht Charter K6Yachting - Bella Vita - Corsica France