Parsing RSS

Discussion in 'XML & RSS' started by Eagle Eyes, Oct 21, 2006.

Thread Status:
Not open for further replies.
  1. #1
    Does anyone know how can i parse rss feed with magpie? Is anyone good with it? Right now what i want to parse from this feed is.

    http://www.pakistaniforces.com/news/publish/rss.xml

    [B]Category0[/B]
    Article Name0 (link embeded)
    [B]Category1[/B]
    Article Name1 (link embeded)
    [B]Category2[/B]
    Article Name2 (link embeded)
    [B]Category3[/B]
    Article Name3 (link embeded)
    Code (markup):
    How can i do this? Is anyone experienced with Magpie here? Also i would like to parse same feed with a different style in a different table on the same page. The way i want to get that done is.

    Category0
    Article Name0 (link embeded)
    Description of the article, in a normal manner.
    Code (markup):
    I would really appreciate you guys help in this regard with magpie. I am no php specialist, so someone could create a code for me. For example.

    <?php
    //---Code to display RSS feeds using MagpieRSS
    include "/home/pakistan/public_html/magpierss/rss_fetch.inc";  //include the magpierss script
    define('MAGPIECACHEDIR', '/tmp/magpie_cache');
    $url = 'http://www.pakistaniforces.com/news/publish/rss.xml';  //this is the url of the feed, enter your own url here
    $rss = fetch_rss( $url );
    
    for ($i = 14; $i < sizeof($rss->items); $i++){
        $output .= '<a target="" href="'.$rss->items[$i]['link'].'">'.$rss->items[$i]['title'].'</a><br>';
    }    	
    echo $output;
    //--
    ?>
    Code (markup):
    Thanks.
     
    Eagle Eyes, Oct 21, 2006 IP
  2. patsalko

    patsalko Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    have u looked at the example on the magpie page?
    what u're trying to do is explained there
     
    patsalko, Oct 23, 2006 IP
  3. Eagle Eyes

    Eagle Eyes Well-Known Member

    Messages:
    413
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #3
    Yes, but i couldn't understand it. I wonder if you could help me with it. So i can prase the RSS feed in that manner.
     
    Eagle Eyes, Oct 29, 2006 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,830
    Likes Received:
    4,541
    Best Answers:
    123
    Trophy Points:
    665
    #4
    Take a look at this tutorial and come back with any questions: Using Magpie RSS
     
    sarahk, Oct 29, 2006 IP
  5. Eagle Eyes

    Eagle Eyes Well-Known Member

    Messages:
    413
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #5
    Thats one great tutorial! Is it possible for you to tell me what to put in that code so it also parses <category> with the titles?

    Also it gives me this error when i want to parse the same feed, on the same page twice. I have used the same code you have provided above.

     
    Eagle Eyes, Nov 5, 2006 IP
Thread Status:
Not open for further replies.