PHP5 SOAP XML 到数组中
我目前有 SOAP 调用的返回。
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns:getMakeResponse xmlns:ns="http://ws.fds.com">
<ns:return>
<ResponseCode>000</ResponseCode>
<ResponseDescription>No Errors</ResponseDescription>
<MakeReturn>
<Make>JEEP</Make>
<MakeDescription>JEEP</MakeDescription>
</MakeReturn>
<MakeReturn>
<Make>CHRY</Make>
<MakeDescription>CHRYSLER</MakeDescription>
</MakeReturn>
<ns:return>
</ns:getMakeResponse>
</soapenv:Body>
</soapenv:Envelope>
我怎样才能把它变成一个像下面这样的数组,或者类似的东西?
Array
(
[id] => 1
[responsecode] => 000
[responsedescription] => No Errors
[0] => Array
(
[make] => JEEP
[makedescription] => JEEP
)
[1] => Array
(
[make] => CHRY
[makedescription] => CHRYSLER
)
)
感谢您提供的任何帮助!
I currently have a return from a SOAP call.
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns:getMakeResponse xmlns:ns="http://ws.fds.com">
<ns:return>
<ResponseCode>000</ResponseCode>
<ResponseDescription>No Errors</ResponseDescription>
<MakeReturn>
<Make>JEEP</Make>
<MakeDescription>JEEP</MakeDescription>
</MakeReturn>
<MakeReturn>
<Make>CHRY</Make>
<MakeDescription>CHRYSLER</MakeDescription>
</MakeReturn>
<ns:return>
</ns:getMakeResponse>
</soapenv:Body>
</soapenv:Envelope>
How can I turn this into an array like below, or something similar?
Array
(
[id] => 1
[responsecode] => 000
[responsedescription] => No Errors
[0] => Array
(
[make] => JEEP
[makedescription] => JEEP
)
[1] => Array
(
[make] => CHRY
[makedescription] => CHRYSLER
)
)
Thanks for any help provided!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了这个
http://www.bin-co.com/php/scripts/xml2array/< /a>
这似乎运作得相当好。
I found this
http://www.bin-co.com/php/scripts/xml2array/
Which seems to work rather well.
如果您使用本机 PHP SoapClient,输出已经转储到 PHP 对象中...
查看 $output 对象,它应该具有您想要的大部分内容...
If your using the native PHP SoapClient the output already gets dumped into a PHP Object...
Look at the $output object, it should have most of what you want...