Php Soap,将结果转储为 XMl 文件?
我得到了 SOAP(普通 php 客户端)结果 根据我的要求 我想将结果保存为 XML 文件?但如何呢?
$result = $client->__soapCall('MYwebServices',array($params));
$xml = simplexml_load_string($result);
$fp = fopen("out.xml","w");
fwrite($fp,$xml);
fclose($fp);
I got a SOAP (normal php client) Result
from my request
I want to save the result as a XML file ? But how ?
$result = $client->__soapCall('MYwebServices',array($params));
$xml = simplexml_load_string($result);
$fp = fopen("out.xml","w");
fwrite($fp,$xml);
fclose($fp);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你想获取Web服务返回的XML,你应该使用
SoapClient::__getLastResponse()
(以及
trace
选项)。If you want to get the XML returned by the web service, you should use
SoapClient::__getLastResponse()
(along with thetrace
option).SimpleXMLElement::asXML
参考SimpleXMLElement::asXML
reference上面的代码是否不这样做,如果不尝试:
如果返回不是 xml 或 xml 格式不正确,这可能会被破坏,在这种情况下尝试以下操作:
Does the code above not do it, if not try:
This might be broken if the return is not xml or the xml is improperly formatted, in which case try this: