# Using XML to PHP parser with this file

**URL:** <https://forum.kirupa.com/t/using-xml-to-php-parser-with-this-file/194558>\
**Category:** programming\
**Created:** [July 24, 2006, 4:23pm UTC](https://forum.kirupa.com/t/using-xml-to-php-parser-with-this-file/194558 "2006-07-24T16:23:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![magnastik](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@magnastik](https://forum.kirupa.com/u/magnastik)\
**Post date:** [July 24, 2006, 4:23pm UTC](https://forum.kirupa.com/t/using-xml-to-php-parser-with-this-file/194558/1 "2006-07-24T16:23:24Z")

</div>

Hi!  
I was trying to use the tutorial and i understand it but i don’t know how to make it functional in my situation.

I have a XML file with the currencies from the European Central Bank and i would like to know how to to retrieve the Rate from a certain Currency. Here is the xml code:

> \<?xml version=“1.0” encoding=“UTF-8”?\>  
> \<gesmes:Envelope xmlns:gesmes=“[http://www.gesmes.org/xml/2002-08-01](http://www.gesmes.org/xml/2002-08-01)” xmlns=“[http://www.ecb.int/vocabulary/2002-08-01/eurofxref](http://www.ecb.int/vocabulary/2002-08-01/eurofxref)”\>  
> \<gesmes:subject\>Reference rates\</gesmes:subject\>  
> \<gesmes:Sender\>  
> \<gesmes:name\>European Central Bank\</gesmes:name\>  
> \</gesmes:Sender\>  
> \<Cube\>  
> \<Cube time=“2006-07-24”\>  
> \<Cube currency=“USD” rate=“1.2633”/\>  
> \<Cube currency=“JPY” rate=“147.32”/\>  
> \<Cube currency=“CYP” rate=“0.5750”/\>  
> \<Cube currency=“CZK” rate=“28.435”/\>  
> \<Cube currency=“DKK” rate=“7.4604”/\>  
> \<Cube currency=“EEK” rate=“15.6466”/\>  
> \<Cube currency=“GBP” rate=“0.68160”/\>  
> \<Cube currency=“HUF” rate=“276.06”/\>  
> \<Cube currency=“LTL” rate=“3.4528”/\>  
> \<Cube currency=“LVL” rate=“0.6960”/\>  
> \<Cube currency=“MTL” rate=“0.4293”/\>  
> \<Cube currency=“PLN” rate=“3.9433”/\>  
> \<Cube currency=“SEK” rate=“9.2595”/\>  
> \<Cube currency=“SIT” rate=“239.65”/\>  
> \<Cube currency=“SKK” rate=“38.385”/\>  
> \<Cube currency=“CHF” rate=“1.5746”/\>  
> \<Cube currency=“ISK” rate=“93.48”/\>  
> \<Cube currency=“NOK” rate=“7.9540”/\>  
> \<Cube currency=“BGN” rate=“1.9558”/\>  
> \<Cube currency=“HRK” rate=“7.2540”/\>  
> \<Cube currency=“RON” rate=“3.5640”/\>  
> \<Cube currency=“RUB” rate=“34.0175”/\>  
> \<Cube currency=“TRY” rate=“1.9600”/\>  
> \<Cube currency=“AUD” rate=“1.6773”/\>  
> \<Cube currency=“CAD” rate=“1.4405”/\>  
> \<Cube currency=“CNY” rate=“10.0868”/\>  
> \<Cube currency=“HKD” rate=“9.8256”/\>  
> \<Cube currency=“IDR” rate=“11603.41”/\>  
> \<Cube currency=“KRW” rate=“1202.41”/\>  
> \<Cube currency=“MYR” rate=“4.6673”/\>  
> \<Cube currency=“NZD” rate=“2.0321”/\>  
> \<Cube currency=“PHP” rate=“65.875”/\>  
> \<Cube currency=“SGD” rate=“2.0025”/\>  
> \<Cube currency=“THB” rate=“48.030”/\>  
> \<Cube currency=“ZAR” rate=“8.9041”/\>  
> \</Cube\>  
> \</Cube\>  
> \</gesmes:Envelope\>

So… for exemple, how do i get the Rate from Currency = USD into a PHP variable??

Thanks in advance,  
MagNastiK
