Results 1 to 3 of 3

Thread: How to Limit RSS feeds?

  1. #1
    Join Date
    Nov 2010
    Posts
    31
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Default How to Limit RSS feeds?

    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:
    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

  2. #2
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 21 Times in 21 Posts

    Default

    Can you post up the xml array that you are working with from the feed. Have you tried just
    PHP Code:
    $feed string($xml->channel->item[0]);
    echo 
    $feed 
    Or any variations of things like that?

  3. #3
    Join Date
    Nov 2010
    Posts
    31
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Default

    I think a variation of this will help me. Thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •