Bayler Posted January 4, 2008 Share Posted January 4, 2008 in an attempt to parse out data from www.xfire.com ... example: http://www.xfire.com/xml/sgteversmen/screenshots/ and using a parser from: www.criticaldevelopment.net/xml/ allows me to display all information like this: foreach($parser->document->screenshot as $screenshots){ $images = $screenshots->filename[0]->tagData; } Question now is.. how can i display ALL of the Game Titles..but only one time each ? Quote Link to comment https://forums.phpfreaks.com/topic/84394-xml-to-php/ Share on other sites More sharing options...
hitman6003 Posted January 4, 2008 Share Posted January 4, 2008 Not sure about the exact syntax for using the xml parser, but you can just put the titles into an array: foreach($parser->document->screenshot as $screenshots){ $images = $screenshots->filename[0]->tagData; if (!in_array($screenshots->game[0]->tagData, $game_titles)) { $game_titles[] = $screenshots->game[0]->tagData; } } array_map(create_function('$g_t', 'echo "Title: $g_t\n"'), $game_titles); Quote Link to comment https://forums.phpfreaks.com/topic/84394-xml-to-php/#findComment-429903 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.