How can I extract useful content from an interface that can get the returned xml file? After the interface is called, $ result = & nbsp; can get the following content: stdClass & nbsp; Object (& nbsp; [out] & nbsp; = & gt; & nbsp; & lt ;? Xml & nbsp; version = "1.0" & nbsp an interface to obtain the returned xml file. how can I extract useful content?
After the interface is called, $ result = can get the following content:
StdClass Object
(
[Out] =>
?
? T
)
Previously, this directly reads xml, but this kind of Object with stdClass ([out] =>
I don't know how to read the content of each node.
------ Solution --------------------
If you are not familiar with object operations, you can convert them to arrays first, which makes it easier.
The object you get is very simple. $ result-> out is the XML string. if you want to extract the content, you can try string extraction, or parse XML as the object and convert it to an array (recommended ).
http://www.php.net/manual/zh/language.oop5.properties.php
------ Solution --------------------
Print directly
Echo $ result-> out;
Parse as xml
$ Xml = simplexml_load_string ($ result-> out );
Print_r ($ xml );
SimpleXMLElement Object
(
[flights] => SimpleXMLElement Object
(
[flight] => SimpleXMLElement Object
(
[@attributes] => Array
(
[orgCity] => SHA
[departTerm] => T2
[dstCity] => CAN
[arrivalTerm] => --
[airComp] => MU
[flightno] => MU5307
[planeType] => 320