Dealing with xml file and php



currently trying to parse this file: http://ift.tt/1pwc4sU


I am currently bringing it in like this:



$xml = simplexml_load_string(file_get_contents($url));

foreach ($xml->group->o as $game)
{


That correctly gets the array of information into $game, but my problem is how to access the "platform" tags inside the "platforms" tag, which is also inside the "attrs" tag (so many levels!).


How can I easily get access to that? I was thinking like this to check if say Linux is a platform:



if (in_array('Linux', $game->attrs->platforms->platform))
{
echo 'Linux: Yes';
}


That just isn't right though it seems.


No comments:

Post a Comment