PHP Code:
<?php
//*****************************************
//This rather ugly code is done by Shane *
// Contact Shane: shane@matrixau.net *
// Exclusively for YoungCoders.com! *
// *
// PLEASE DON'T REMOVE THIS IF POSSIBLE! *
//*****************************************
//Get file's contents
$content = file_get_contents("http://www.xe.com/ucc/convert.cgi?From=" .$_GET['from']. "&To=" .$_GET['to']. "&Amount=" .$_GET['amount']. "&template=pca-xetrade");
//Define the HTML code we have to break down with a uniqe peice of HTML code found in that page.
$content = explode('<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0>',$content);
//We will get rid of this line to get rid of the left over code above the bits we want to get to.
$content = str_replace('<TD VALIGN=MIDDLE ALIGN=RIGHT><FONT FACE="Arial,Helvetica"><B>', "", "$content[1]");
//Once again defining our way to the final converted number...
$content = explode('<TD COLSPAN=3 ALIGN=CENTER><FONT FACE="Arial,Helvetica" SIZE=-2>',$content);
//Remove every bit of HTML code left that isn't numeric!
$toremove = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", ">", "<", "\"", "\'", "=", ",", "/", "-1");
$content = str_replace($toremove, "", "$content[0]");
//Final thing to remove, Woo Hoo! We will use '+1' to sperate the two numeric values of the two currencys.
$final = explode('+1',$content);
//Make the currency codes in upper case...
$from_code = strtoupper($_GET['from']);
$to_code = strtoupper($_GET['to']);
//The final conversion
echo '<b>' .$final[0]. ' ' .$from_code. ' =' .$final[1]. ' ' .$to_code. '</b>';
?>
Feel free to make comments on my messy code. :p.