sample php code to convert currency from xe.com using curl
<?php
$url = "http://www.xe.com/currencyconverter/convert/?Amount=1&From=USD&To=PHP";
$ch = curl_init(); // Initialize a CURL session.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Return Page contents.
curl_setopt($ch, CURLOPT_URL, $url); // Pass URL as parameter.
$data = curl_exec($ch); // grab URL and pass it to the variable.
curl_close($ch); // close curl resource, and free up system resources.
$dom = new DOMDocument();
@$dom->loadHTML($data);
$xpath = new DOMXPath($dom);
$tableRows = $xpath->query('//table//tr');
$details = array();
foreach ($tableRows as $row) {
// fetch all 'tds' inside this 'tr'
$td = $xpath->query('td', $row);
if ($td->length == 3 ):
foreach($td as $key => $val){
if($key==0 Or $key ==2) {
$details[] = preg_replace('/[^a-zA-Z0-9, '.:]*/i', '',$val->nodeValue);
}
}
endif;
}
print "<pre>";
print_r($details);
print "</pre>";
?>