I'm trying to figure out how to get a specific value from the XML
Code :-
function getUrlContent($url,$xml_get_subscriber_info){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_get_subscriber_info);
$data = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
//return ($httpcode>=200 && $httpcode<300) ? $data : false;
return $data;
$a = simplexml_load_string(getURLContent($url,$xml_get_subscriber_info));
The XML :-
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ><SOAP-ENV:Body>
<ns2:root>
<msg_head>
<time>2020-08-20 17:57:29</time>
<from />
<to />
<msg_type />
<serial />
</msg_head>
<interface_msg>
<msg_response>
<ResponseClass Name="Response">
<GetUserClass Name="AJAX">
<ResultCode>0</ResultCode>
<ResultDescr>success</ResultDescr>
<IBAN>1</IBAN>
<PACKAGEID>208$268$269$345$481$482$619$653$656$663$665$702$764$768$1128$1130$1143$1156$1166</PACKAGEID>
<USRSTATUS>1</USRSTATUS>
<PREFERNOTIFYMETHOD>1</PREFERNOTIFYMETHOD>
</GetUserClass>
</ResponseClass>
</msg_response>
</interface_msg>
</ns2:root>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I'm trying to get the packageID payload but i've tried all sort even using loadXML function but sometimes i have parser issue using the loadXML due to high load but now i've decided to change to simple_load_xml.
I've tried the following method :-
print_r($xml->children("SOAP-ENV", true)->children("ns2", true));
Even tried to cast it as a namespace , no luck
$xml = simplexml_load_string($result,"SimpleXMLElement", 0, "SOAP-ENV", true);