2012-02-29, 05:41 AM
Alexa site info returns the following XML.
I'm using simplexml to parse the data.
In the XML returned, it has 2 elements named <SD>. I wish to get the POPULARITY data from second <SD> element, but since there is already an SD element present, it doesn't read the second one.
For example, i can read LINSKIN data from first <SD> family with $xml->SD->LINKSIN['NUM']
But i can't access POPULARITY data from second <SD> family using $xml->SD->POPULARITY['TEXT'].
Is there any way to get it?
<ALEXA VER="0.9" URL="mybb.com/" HOME="0" AID="=">
<RLS PREFIX="http://" more="0">
</RLS>
<SD TITLE="A" FLAGS="DMOZ" HOST="mybb.com">
<TITLE TEXT="mybb.com | Travel "/>
<LINKSIN NUM="20581"/>
<SPEED TEXT="1265" PCT="56"/>
<REVIEWS AVG="4.0" NUM="4"/>
<CHILD SRATING="0"/>
</SD>
<DMOZ>
<SITE BASE="mybb.com/" TITLE="MyBB" DESC="The official site for the forum software informs on features, ideas, and mods, and offers downloads and a forum.">
<CATS><CAT ID="Top/Computers/Programming/Languages/PHP/Scripts/Forums/MyBB" TITLE="Forums/MyBB" CID="377847"/></CATS>
</SITE>
</DMOZ>
<SD>
<POPULARITY URL="mybb.com/" TEXT="5977"/>
<REACH RANK="8781"/>
<RANK DELTA="-107"/>
</SD>
</ALEXA>
I'm using simplexml to parse the data.
In the XML returned, it has 2 elements named <SD>. I wish to get the POPULARITY data from second <SD> element, but since there is already an SD element present, it doesn't read the second one.
For example, i can read LINSKIN data from first <SD> family with $xml->SD->LINKSIN['NUM']
But i can't access POPULARITY data from second <SD> family using $xml->SD->POPULARITY['TEXT'].
Is there any way to get it?