I have a php variable ($output) that is holding a xml file with the following attributes
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="tns:ns">
<SOAP-ENV:Body><ns1:transactionStatusResponse>
<MSISDN>254705680609</MSISDN>
<AMOUNT>10</AMOUNT>
<MPESA_TRX_DATE>2016-05-21 10:57:43</MPESA_TRX_DATE>
<MPESA_TRX_ID>KEL7STGYEL</MPESA_TRX_ID>
<TRX_STATUS>Success</TRX_STATUS>
<RETURN_CODE>00</RETURN_CODE>
<DESCRIPTION>The service request is processed successfully.</DESCRIPTION>
<MERCHANT_TRANSACTION_ID/>
<ENC_PARAMS></ENC_PARAMS>
<TRX_ID>308e6137d9888ee8ead15c9577802947</TRX_ID>
</ns1:transactionStatusResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Now I am trying to put the individual xml attributes into php varibles but I seems not to be working. This is the what I am trying to use to extract the individual attributes
$xml = @simplexml_load_string($output);
$MPESA_TRX_ID= (string)$xml->MPESA_TRX_ID;
$MSISDN = (string)$xml->MSISDN;
$AMOUNT = (string)$xml->AMOUNT;
Any workarounds this?