|
Friday, 22 May 2009 09:47 |
|
Hello,
I am looking for a PHP class that will transform an XML document like the below into a PHP array that I can then use.
<?xml version="1.0"?>
<Response id="53e3d21753d5fa43bb0caf70753f5aa3">
<block name="availability">
<a name="quick-result" format="counting">5</a>
<a name="postcode" format="postcode">SO50 4HL</a>
<block name="classic-qualification">
<a name="result-code" format="text">Z</a>
<a name="fixed-rate" format="text">G</a>
<a name="likely-max-speed" format="counting">2097152</a>
<a name="rate-adaptive" format="text">G</a>
</block>
<block name="exchange">
<a name="code" format="text">STEASTL</a>
<a name="name" format="text">EASTLEIGH</a>
<a name="state" format="text">E</a>
<a name="llu" format="yesno">Y</a>
</block>
<block name="max-qualification">
<a name="rate-adaptive" format="text">G</a>
<a name="likely-max-speed" format="counting">6144000</a>
</block>
</block>
<status no="0"/>
</Response>
I don't care about the format aspect but need the names and values:
As an example I would like to be able to access EASTLEIGH via ..
$xml['availability']['exchange']['name']
The XML output will vary but always follow this format.
Thanks,
Ben
|