Hi i am making a arcade site, and it would be nice if you could use a gamefeed.
ived tryed all day to get data from xml files and add it to my mysql db, but i cant get it working.
This is the xml file i want to get info from:
http://www.freegamesforyourwebsite.com/feeds.php?feed=latest-games&format=rss
and the i want to put it into my db
can you please help me :-)?
i tryed this:
<?php
$feedUrl = 'http://playtomic.com/games/feed/playtomic?format=xml';
$ret = array();
// retrieve search results
if($xml = simplexml_load_file($feedUrl)) {
$result["item"] = $xml->xpath("/rss/channel/item");
foreach($result as $key => $attribute) {
$i=0;
foreach($attribute as $element) {
$ret[$i]['title'] = (string)$element->title;
$ret[$i]['swf'] = (string)$element->SWF;
$i++;
}
}
}
echo "<pre>";
print_r($ret);
?>