I have an issue reading this XML data.
<?xml version="1.0"?>
<DOCUMENT>
<VERSION>2.0</VERSION>
<MESSAGES>
<MESSAGE>
<SEND_DATE>2014-02-26</SEND_DATE>
<ENTITY_ID>7002</ENTITY_ID>
<RECIPIENT_NUM>xxxxxxxxxxxxxx</RECIPIENT_NUM>
<MESSAGE_PARAMS>
<DEN_SURNAME>Roze</DEN_SURNAME>
<APPT_DATE>27/02/14</APPT_DATE>
<APPT_TIME>09:00</APPT_TIME>
</MESSAGE_PARAMS>
</MESSAGE>
<MESSAGE>
<SEND_DATE>2014-02-26</SEND_DATE>
<ENTITY_ID>7002</ENTITY_ID>
<RECIPIENT_NUM>xxxxxxxxxxxx</RECIPIENT_NUM>
<MESSAGE_PARAMS>
<DEN_SURNAME>Roze</DEN_SURNAME>
<APPT_DATE>27/02/14</APPT_DATE>
<APPT_TIME>09:00</APPT_TIME>
</MESSAGE_PARAMS>
</MESSAGE>
<MESSAGE>
<SEND_DATE>2014-02-26</SEND_DATE>
<ENTITY_ID>7002</ENTITY_ID>
<RECIPIENT_NUM>xxxxxxxxxxxxxx</RECIPIENT_NUM>
<MESSAGE_PARAMS>
<DEN_SURNAME>Roze</DEN_SURNAME>
<APPT_DATE>27/02/14</APPT_DATE>
<APPT_TIME>09:00</APPT_TIME>
</MESSAGE_PARAMS>
</MESSAGE>
</MESSAGES>
</DOCUMENT>
I have a <MESSAGES> tag containing several <MESSAGE> tags containing different values. I am currently using this code to read the values inside each <MESSAGE> tag.
$dr_name=$xml->MESSAGES->MESSAGE->MESSAGE_PARAMS->DEN_SURNAME;
$apt_date= $xml->MESSAGES->MESSAGE->MESSAGE_PARAMS->APPT_DATE;
$apt_time= $xml->MESSAGES->MESSAGE->MESSAGE_PARAMS->APPT_TIME;
I am getting only the values for the first <MESSAGE> tag.
How can I read all the <MESSAGE> tags?