Jump to content

Recommended Posts

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 ?

Link to comment
https://forums.phpfreaks.com/topic/84394-xml-to-php/
Share on other sites

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);

Link to comment
https://forums.phpfreaks.com/topic/84394-xml-to-php/#findComment-429903
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.