ASP web bot that get exchange rates

Thanks to Bank of Italy (Banca d’Italia), there are free exchange rates data that are easy to retrieve and parse,…

Dicembre 23, 2009

Thanks to Bank of Italy (Banca d’Italia), there are free exchange rates data that are easy to retrieve and parse, here is the code of a mini webbot written in ASP that goes out on Bank of Italy site, get the exchanges rates and print them. It’s very easy to customize and use it (since there are also historical data you can also make graphs like this).

exchange rates graph

<%
Dim yesterday
yesterday = dateadd("d",-1,date)

Dim objHttp
Set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
objHttp.Open "GET", "http://uif.bancaditalia.it/UICFEWebroot/QueryOneDateAllCur?lang=en&rate=0&initDay=" & Day(yesterday) & "&initMonth=" & Month(yesterday) & "&initYear=" & Year(yesterday) & "&refCur=euro&R1=csv", False
objHttp.Send
If objHttp.Status = 200 Then
	Dim arrLines
	Dim arrFields

	Dim i
	arrLines = Split(objHttp.ResponseText,Chr(10))
	For i = 0 To UBound(arrLines)-1
		If i >= 4 then
			arrFields = Split(arrLines(i),",")
			response.write arrFields(4) & " " & arrFields(1) & " (" & arrFields(2) & ") per 1 EUR<br/>"
		End if
	Next 
Else
	Response.Write(objHttp.Status & " - " & objHttp.StatusText)
End If
Set objHttp = Nothing
%>

Author

PHP expert. Wordpress plugin and theme developer. Father, Maker, Arduino and ESP8266 enthusiast.

Comments on “ASP web bot that get exchange rates”

Just one thought

  1. Federico Zeleznik ha detto:

    Can it be much better? I have been searching on google, yahoo and many other places, now I found the answers, thanks to the admin..

Comments are closed