Pull XML nodeValue into php Variable

denizzz

New Member
I am trying to assign the \[code\]<all>\[/code\] / \[code\]<avg>\[/code\] value in this XML code to a variable, so that I can use it for calculations. But when I do this, and try to print the value, I get a blank screen. Can someone please help? \[code\]<stats> <type id="a"> <buy> <volume>698299009</volume> <avg>17.94</avg> <max>18.45</max> <min>1.00</min> </buy> <sell> <volume>16375234</volume> <avg>21.03</avg> <max>24.99</max> <min>20.78</min> </sell> <all> <volume>714674243</volume> <avg>18.01</avg> <max>24.99</max> <min>1.00</min> </all> </type></stats>\[/code\]The php code I am using is as follows:\[code\]$xml = simplexml_load_file("values.xml");$unit_value = http://stackoverflow.com/questions/11472841/$xml->xpath("/stats/type[@id='a']/buy/avg/")->nodeValue;echo $unit_value;\[/code\]
 
Back
Top