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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lauthiamkok
Forum Contributor
Posts: 153
Joined: Wed Apr 01, 2009 2:23 pm
Location: Plymouth, United Kingdom

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

Post 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
divito
Forum Commoner
Posts: 89
Joined: Sun Feb 22, 2009 7:29 am

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

Post 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.
lauthiamkok
Forum Contributor
Posts: 153
Joined: Wed Apr 01, 2009 2:23 pm
Location: Plymouth, United Kingdom

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

Post 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
Post Reply