Getting Up-to-Date Exchange Rates

by Feb 21, 2011

If you would like to get currency exchange rates, you can simply access a Web service from one of the major banks. Here is how to get the USD exchange rate:

$xml = New-Object xml
$xml.Load('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml')
$rates = $xml.Envelope.Cube.Cube.Cube
"Current USD exchange rate:"
$usd = $rates | Where-Object { $_.currency -eq 'USD' } |
Select-Object -ExpandProperty rate
$usd

Twitter This Tip!
ReTweet this Tip!