在SOAP调用之后获取XML字段[重复]

This question already has an answer here:

My asmx WEB service return this XML

   <?xml version="1.0" encoding="ISO-8859-1"?>
   <PRODUCT>
     <DESC>Vanilla ice cream</DESC>
     <CODEERR>0</CODEERR>
   </PRODUCT>

Calling WEB service from this PHP code

  $SoapCli = new SoapClient('http://www.foo.com/MyService.asmx?WSDL');
        $params = array(
          'PARAM1' => 'some_param_1',
          'PARAM2' => 'some_param_2',
        );
        $resp_WS = $SoapCli->__soapCall('MyFunction', array($params));
        var_dump($resp_WS);

result is

object(stdClass)#11946 (1) {
  ["MyFunctionResult"]=&gt;
  object(stdClass)#11947 (1) {
    ["any"]=&gt;
    string(88) "<product xmlns=""><desc>Vanilla ice cream</desc><codeerr>0</codeerr></product>"
  }
}

but, after googling a lot, I don't find PHP code for retreive values ​​of two fields DESC and CODER

</div>

You can use json_encode,json_decode,simplexml_load_string to parse the XML response, try the following code snippet to read the XML response

$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>
         <PRODUCT>
           <DESC>Vanilla ice cream</DESC>
           <CODEERR>0</CODEERR>
         </PRODUCT>';

 $res = json_decode(json_encode((array)simplexml_load_string($xml)),true);

Now you can use $res['DESC'] and $res['CODEERR'] to retrive the values.