Reputation: 405
I have been testing a lot of XML parser function but I had no success extracting the value. I wonder what went wrong. I want to get the value of STATUS_DESC AND STATUS_CODE in XML.
XML doc
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://service.xxx/">
<ErrorInfo>
<STATUS_CODE>0105</STATUS_CODE>
<REQUEST_TIME>11/28/2014 3:54:06 AM</REQUEST_TIME>
<TIME_INTERVAL>300</TIME_INTERVAL>
<STATUS_DESC>Unable to fetch Data </STATUS_DESC>
</ErrorInfo>
</string>
PHP
<?php
$xml=simplexml_load_string($xml);
var_dump($xml);
// var_dump result:
// object(SimpleXMLElement)#25 (1) { [0]=> string(48) "010511/28/2014 3:54:06 AM300Unable to fetch Data" }
$error=$xml->ErrorInfo;
$error1=$xml->ErrorInfo->STATUS_DESC;
echo $error; // Nothing
echo $error1; // Nothing
?>
Upvotes: 1
Views: 41