Parsing XML Attributes by name with PHP5



When trying to parse an XML document in PHP, nothing is returned.


The XML document im trying to use:


http://ift.tt/1vRwpvt


The code I have tried:



$player = simplexml_load_file('http://ift.tt/1vRwpvt');
foreach ($player->PlayerName as $playerInfo) {
echo $playerInfo['firstName'];
}


I have also tried:



$player = simplexml_load_file('http://ift.tt/1vRwpvt');
echo "Name: " . $player->PlayerName[0]['firstName'];


What do I need to change for the attributes to show?


No comments:

Post a Comment