Page 1 of 1

How to read and display a rss feed on my website with php

Posted: Wed Apr 08, 2009 3:18 pm
by lauthiamkok
Hi,
I want to read and display a RSS feed from a news site onto my website, for instance this is the RSS URL which I want to pull the news feed from,

http://pipes.yahoo.com/pipes/pipe.run?_ ... render=rss

I have been searching for some tutorial online, but still cannot find any good resources.

Please let me know whether you know any tutorial online, or you know how to programme this with php.

Many thanks,
Lau

Re: How to read and display a rss feed on my website with php

Posted: Thu Apr 09, 2009 5:46 am
by divito
You want something like MagpieRSS.

I use it on a site I'm currently making. I can try to help you set it up if you'd like.

Re: How to read and display a rss feed on my website with php

Posted: Thu Apr 09, 2009 5:58 am
by lauthiamkok
hello, thanks for the offer and help. yes someone has pointed out MagpieRSS and now I am working on this. it looks great!

http://magpierss.sourceforge.net/

Code: Select all

require_once 'rss_fetch.inc';
 
$url = 'http://pipes.yahoo.com/pipes/pipe.run?_id=YGtVQgki3hG_o3ZZ0j6skA&_render=rss';
$rss = fetch_rss($url);
 
foreach ($rss->items as $item) {
    $title = $item[title];
    $url   = $item[link];
    echo "<a href='$url'>$title</a><br />";
}

best,
Lau