Web bot for exchange rates


/ Published in: ASP
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. <%
  2. Dim yesterday
  3. yesterday = dateadd("d",-1,date)
  4.  
  5. Dim objHttp
  6. Set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
  7. 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
  8. objHttp.Send
  9. If objHttp.Status = 200 Then
  10. Dim arrLines
  11. Dim arrFields
  12.  
  13. Dim i
  14. arrLines = Split(objHttp.ResponseText,Chr(10))
  15. For i = 0 To UBound(arrLines)-1
  16. If i >= 4 then
  17. arrFields = Split(arrLines(i),",")
  18. response.write arrFields(4) & " " & arrFields(1) & " (" & arrFields(2) & ") per 1 EUR<br/>"
  19. End if
  20. Next
  21. Else
  22. Response.Write(objHttp.Status & " - " & objHttp.StatusText)
  23. End If
  24. Set objHttp = Nothing
  25. %>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.