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

<%
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
%>
Tags: exchange rates, Microsoft.XMLHTTP, Spider, Web bot
If you have a user input that may contains some error you can try to check the spelling using Google Spelling Suggestion service (there is an api and you have to register to have an api key to use their web services).
But you can obtain the same result searching the Google search engine and parsing the html code to find the link after the phrase: “Did you mean“. You can think at this code as a mini web bot spell checker.
This code works in any language, it finds the anchor tag that has the classname set to “spell”:
DEMO
echo doGoogleSpelling("wokipedia"); //returns "wikipedia"
function doGoogleSpelling($q) {
// grab google page with search
$web_page = file_get_contents( "http://www.google.it/search?q=" . urlencode($q) );
// put anchors tag in an array
preg_match_all('#<a([^>]*)?>(.*)</a>#Us', $web_page, $a_array);
for($j=0;$j<count($a_array[0]);$j++) {
// find link with spell suggestion and return it
if(stristr($a_array[0][$j],"class=spell")) return strip_tags($a_array[0][$j]);
}
return "";
}
Tags: File_get_contents, Google, Parsing, Preg_match_all, Regular expression, Spell, Spell checker, Spell checking, Spelling, Spider, Web bot