Page 1 of 1

XML > PHP

Posted: Wed Apr 08, 2009 11:11 am
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 />";
  }
?>