Answer the question
In order to leave comments, you need to log in
Why does it output 0 when parsing Xml?
$rest_urls = 'myurl';
$xml_responses = file_get_contents($rest_urls);
$xml_records = simplexml_load_string($xml_responses);
$AntiBrakeSystem = $xml_records->atttoi->Anti-BrakeSystem;
echo 'AntiBrakeSystem:'.$AntiBrakeSystem.'<br/>';
<result>
<ddd>dfgdf</ddd>
<atttoi>
<Anti-BrakeSystem>4-Wheel ABS</Anti-BrakeSystem>
</attributes>
</result>
Answer the question
In order to leave comments, you need to log in
First, the XML contains errors (atttoi is not closed and attributes is not opened). The correct XML in your case should look like this:
<result>
<ddd>dfgdf</ddd>
<atttoi>
<Anti-BrakeSystem>4-Wheel ABS</Anti-BrakeSystem>
</atttoi>
</result>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question