Thanks in advance!
Get latest posts from multiple feeds
Moderator: General Moderators
-
renieravin
- Forum Newbie
- Posts: 3
- Joined: Tue Sep 04, 2007 12:20 am
Get latest posts from multiple feeds
Need some help - badly! I have a directory of bloggers, where I store the RSS feed url's of their blogs in a MySQL db. (There are about 1000 blogs so far) How do I go about displaying the latest posts from these feeds on a page?
Thanks in advance!
Thanks in advance!
-
renieravin
- Forum Newbie
- Posts: 3
- Joined: Tue Sep 04, 2007 12:20 am
thanks
Thanks Anjanesh, the problem is - I have no idea how to do that, although I was wary of having to deal with script timeouts, etc. Basically I can even run a script every few hours which would update the db with the latest posts across all feeds...
Is there any more info you can give me? Is there a ready made script available that I can modify and use?
Is there any more info you can give me? Is there a ready made script available that I can modify and use?
Its just too easy with PHP5's SimpleXML - if you're still on PHP4, seriously consider moving to PHP5 - it'll save a lot of time.
Code: Select all
<?php
$xml = simplexml_load_file("http://rss.anjanesh.net/anjanesh");
foreach($xml->channel->item as $item)
{
echo $item->pubDate.', '.$item->title."<br/>\n";
/*
echo $item->link;
print_r($item->category);
echo $item->description;
*/
}
?>-
renieravin
- Forum Newbie
- Posts: 3
- Joined: Tue Sep 04, 2007 12:20 am
Cool
Thanks a ton man. I have root access to my server, so I had installed PHP 5 on it. Will try out this code soon and let you know if it works.
Also note, even though PHP 5 versions are more-or-less the same, there are couple of differences between PHP 5.0.x, PHP 5.1.x and PHP 5.2.x.
For example, you dont need to escape urls from PHP 5.1.0 for simplexml_load_file contructor. But prior to PHP 5.1.0, you may need to.
So I suggest using PHP 5.2.x (PHP 5.2.4 as of today) since you got root access.
For example, you dont need to escape urls from PHP 5.1.0 for simplexml_load_file contructor. But prior to PHP 5.1.0, you may need to.
So I suggest using PHP 5.2.x (PHP 5.2.4 as of today) since you got root access.