I am trying to get a currency rate from this XML file:
http://www.bank.lv/vk/xml.xml
I am getting a currency ID from a HTML form, after that I have to find it according currency rate.
I am using SimpleXML and XPath, my selection is as follow:
$current_rate = $rates->xpath("/CRates/Currencies/Currency[ID='" .$source_currency ."']/Rate");
$source_currency
is tested and valid, however, when casting $current_rate
to (string)
, I get the word Array
.
Do I have a mistake in the XPath node selection or somewhere else?