I am writing the following:
function getMoneyCountry($cityName, $valRQ) { $requestAddress = "http://www.cbr.ru/scripts/XML_dynamic.asp?date_req1=".date("d/m/Y")."&date_req2=".date("d/m/Y")."&VAL_NM_RQ=".$valRQ; $xml_str = file_get_contents($requestAddress,0); $xml = new SimplexmlElement($xml_str); $count = 0; foreach($xml->ValCurs as $item) { foreach($item->Record as $new) { $money = $new->Value; } } return $money; }
The link is obtained for example:
<ValCurs ID="R01700" DateRange1="31/01/2012" DateRange2="31/01/2012" name="Foreign Currency Market Dynamic"> <Record Date="31.01.2012" Id="R01700J"> <Nominal>1</Nominal> <Value>17,0158</Value> </Record> </ValCurs>
The function returns nothing.