Display number of items in xml file
Posted: Mon Jul 31, 2006 1:43 pm
Hello, I'm new to PHP and I have a question.
I'm working with an xml file that shows flight delays (http://www.flightstats.com/go/rss/airportdelays.do).
In PHP, I need to make a variable that displays the total number of items in the flight delay xml file (i.e. the total number of current delays). I don't need to parse any of the information within the items--I just need code that will look at the XML file and make a variable that shows how many there are.
So for example, if there were two items in the XML file, the variable would equal 2, and I could display something like "Total Reported Delays=2".
Is there any simple way to do this? Will I need some kind of external file to parse the XML, or can PHP handle this kind of thing itself?
Thanks in advance,
Tom
I'm working with an xml file that shows flight delays (http://www.flightstats.com/go/rss/airportdelays.do).
In PHP, I need to make a variable that displays the total number of items in the flight delay xml file (i.e. the total number of current delays). I don't need to parse any of the information within the items--I just need code that will look at the XML file and make a variable that shows how many there are.
So for example, if there were two items in the XML file, the variable would equal 2, and I could display something like "Total Reported Delays=2".
Is there any simple way to do this? Will I need some kind of external file to parse the XML, or can PHP handle this kind of thing itself?
Thanks in advance,
Tom