Search code examples
phpwsdlnusoap

PHP - How to extract the reponse code from nusoap response?


Here's the response from a WSDL

<return code='6000'></return>

I would like to return the code value. Can i use simplexml_load_string() ?


Solution

  • Yes, you can.

    $xml = simplexml_load_string($str);
    
    $code = (int) $xml->attributes()->code;
    

    CodePad.