<?php $soapXMLResult = '<soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <HostCustomerResponse xmlns="http://xx.xx.xx.xx"> <ns1:output xmlns:ns1="http://xx.xx.xx" xmlns:ns2="some:url" xsi:type="ns2:Output"> <ns2:statusCode>00</ns2:statusCode> <ns2:statusMsg/> <ns2:txnResponseDateTime>20190625164236</ns2:txnResponseDateTime> <ns2:txnData> <transferRequest> <transfer> <transferId>123456789</transferId> <txnDate>123456789</txnDate> <debitAcctNo>123456789</debitAcctNo> <benAcctNo>123456789</benAcctNo> </transfer> </transferRequest> </ns2:txnData> </ns1:output> </HostCustomerResponse> </soapenv:Body> </soapenv:Envelope>'; $response = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $soapXMLResult); $xml = new SimpleXMLElement($response); $body = $xml->xpath('//soapenvBody')[0]; $array = json_decode(json_encode((array)$body), TRUE); $transfer = $array['HostCustomerResponse']['ns1output']['ns2txnData']['transferRequest']['transfer']; echo '<pre>'; print_r($transfer);
You have javascript disabled. You will not be able to edit any code.