1 2 3 4 5 6 |
<?php $xml=simplexml_load_file("http://www.yourwebsitethatgivesxml.com/lookup/getxml?username=dog"); print_r($xml); ?> |
Getting this result (called via curl placed into variable called $response)
1 2 3 4 |
<?xml version="1.0" encoding="UTF-8"?> <xml><result>0000</result><errortext>Success</errortext><balance>10.18</balance><type>Prepay</type><currency_symbol>£</currency_symbol><currency_type>GBP</currency_type></xml> |
To get just 10.10 from balance use this
1 2 3 4 |
$xml=simplexml_load_string($response); echo $xml->balance; |