Article: XML Parsing using PHP {Intermediate}

Hi all,

I’ve just finished following the excellent “XML Parsing using PHP {Intermediate}” tutorial on kirupa.com and the basics are working perfectly.

I have an XML feed of server statuses, of which the structure is:


<monitors>
     <monitor id="1">
          <name>Server 1</name>
          <type>HTTP</type>
          <since>01/01/2008</since>
          <status>OK</status>
          <availability>
               <outages>0</outages>
               <downtime>0</downtime>
               <available>100</available>
          </availability>
     </monitor>
</monitors>

I can pull out “name”, “type”, “since” and “status” fine. However, it falls over when trying to extract anything nested inside “availability”, using:


$xml_outages_key = "*MONITORS*MONITOR*AVAILABILITY*OUTAGES";

It would be great if Jubba could help me out if he/she is available!

Many thanks,

  • Joe