I need to a value from this SOAP response. The value is in the loginresponse / return element. Here's the response:
<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/">
<soap-env:body soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:DBCentralIntf-IDBCentral">
<ns1:loginresponse>
<return xsi:type="xsd:string"><**THIS IS THE VALUE I NEED**></return>
</ns1:loginresponse>
</soap-env:body>
Here's how I'm trying to parse:
$response = curl_exec($ch);
curl_close($ch);
$xml = simplexml_load_string($response, NULL, NULL, "http://schemas.xmlsoap.org/soap/envelope/");
$ns = $xml->getNamespaces(true);
$soap = $xml->children($ns['SOAP-ENV']);
$res = $soap->Body->children($ns['NS1']);
print_r($res->LoginResponse->Return);
But I get an empty object.
Thanks for your help!