Posted By

ginoplusio on 12/23/09


Tagged

bot web spider rates exchange


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

ginoplusio
Barlon


Web bot for exchange rates


 / Published in: ASP
 

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

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.

  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. %>

Report this snippet  

You need to login to post a comment.