ntin0s
03-09-2012, 12:32 AM
Hi,
I had problems parsing my rss feeds, it would parse all the feeds and I only need 5-10. I tried using a loop but it outputs the same feed 5 times.
I tried inserting rss in an array but it didnt work for me.
here is my code:
$feed_url = "http://feeds.bbci.co.uk/sport/0/football/rss.xml?edition=uk";
// Get data from feed file
$response = file_get_contents($feed_url);
// Insert XML into structure
$xml = simplexml_load_string($response);
// Browse structure
?><div class="rss-items"><?
?><div class="rss-header"><?echo "RSS FEEDS";?></div><?
foreach($xml->channel->item as $one_item)
$counter = 0;
while ($counter < 5){
++$counter;
echo ($one_item->title);
}
Any help appreciated
I had problems parsing my rss feeds, it would parse all the feeds and I only need 5-10. I tried using a loop but it outputs the same feed 5 times.
I tried inserting rss in an array but it didnt work for me.
here is my code:
$feed_url = "http://feeds.bbci.co.uk/sport/0/football/rss.xml?edition=uk";
// Get data from feed file
$response = file_get_contents($feed_url);
// Insert XML into structure
$xml = simplexml_load_string($response);
// Browse structure
?><div class="rss-items"><?
?><div class="rss-header"><?echo "RSS FEEDS";?></div><?
foreach($xml->channel->item as $one_item)
$counter = 0;
while ($counter < 5){
++$counter;
echo ($one_item->title);
}
Any help appreciated