Return to Snippet

Revision: 21902
at December 23, 2009 09:10 by ginoplusio


Initial Code
<%
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
%>

Initial URL
http://www.barattalo.it/2009/12/23/asp-web-bot-exchange-rates/

Initial Description
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.

Initial Title
Web bot for exchange rates

Initial Tags
web

Initial Language
ASP