XML > PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
FarmerJiles
Forum Newbie
Posts: 1
Joined: Wed Apr 08, 2009 11:06 am

XML > PHP

Post by FarmerJiles »

What I'm trying to achieve with the following script is to pull the contents of the <filename> section and echo them in a list, genuinely using this as a way to list images but it's just echoing the following..
xfire
screenshot:
screenshot:
screenshot:
screenshot:
screenshot:
screenshot:
screenshot:
screenshot:
screenshot:
screenshot:
screenshot:
screenshot:
screenshot:
If somebody could help me sort this so it echoes the <filename> contents such as
0b20a2bd69b5fa46c2ec2f42474f9ca8df12b88e.jpg
That would be great, below is the PHP code I'm currently using. I'm not an expert in the PHP language so be nice :)

Code: Select all

<?php
$xml = simplexml_load_file("http://www.xfire.com/xml/xfire/screenshots/");
 
echo $xml->getName() . "<br />";
 
foreach($xml->children() as $child)
  {
  echo $child->getName() . ": " . $child . "<br />";
  }
?>
Post Reply