Skip to content

Instantly share code, notes, and snippets.

@iamaravi
Created May 5, 2015 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamaravi/98ef17fad85a163a34e7 to your computer and use it in GitHub Desktop.
Save iamaravi/98ef17fad85a163a34e7 to your computer and use it in GitHub Desktop.
xmlparse
<?php
$xmlDOC ='<root>
<status>Success</status>
<error_code>0</error_code>
<cmessage>Delivery challans created</cmessage>
<quote_id>1234567</quote_id>
<items>
<item>
<item_id>000005</item_id>
<item_qty>5.000</item_qty>
<item_price>.072</item_price>
<available_stock>172.000</available_stock>
<branch_id>001</branch_id>
</item>
<item>
<item_id>000006</item_id>
<item_qty>5.000</item_qty>
<item_price>.072</item_price>
<available_stock>172.000</available_stock>
<branch_id>001</branch_id>
</item>
</items>
</root>';
$data = json_decode(json_encode((array) simplexml_load_string($xmlDOC)), 1);
echo "<pre>";
print_r($data);
exit;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment