【问题标题】:view xml content result from web service response in php在 php 中查看来自 web 服务响应的 xml 内容结果
【发布时间】:2013-06-23 12:24:17
【问题描述】:

我正在创建连接到 Web 服务的 php 页面,并将显示来自 Web 服务的结果, Web 服务响应的 xml 如下所示:

<GetUserResponse xmlns="http://the web service">
  <GetUserResult>
    <xsd:schema>schema</xsd:schema>xml
  </GetUserResult>
</GetUserResponse>

我需要知道我从服务中获得的 xml 内容, 以及如何处理或显示在我的页面中?


已解决

我能够使用以下方法解决它:

$xml =simplexml_load_string($result);

【问题讨论】:

    标签: php xml web-services soap schema


    【解决方案1】:
    XML File : myxml.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <note>
        <to>Gauttam</to>
        <from>Kevadia</from>
        <heading>My Heading</heading>
        <body>Body Content Here!!!!</body>
    </note> 
    
    TO read in PHP return with Object :
    
    <?php
        $xml=simplexml_load_file("myxml.xml");
        echo $xml->to . "<br>";
        echo $xml->from . "<br>";
        echo $xml->heading . "<br>";
        echo $xml->body;
        // IF XML file having multiple value retrieve it dynamic with array 
    ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-23
      • 1970-01-01
      • 2016-08-21
      • 1970-01-01
      相关资源
      最近更新 更多