[updated] Uses the lastRSS library to![]()
aggregate RSS feeds.
lastRSS (and this plugin) gives you:
- All RSS versions supported (0.9, 1.0 and 2.0)
- Regullar expression parsing (very quick)
- Returns an associative array with RSS fields
- RSS tags not present in RSS are also not present in result now
- Transparent cache
- Character encoding conversion (all encodings supported by iconv library)
lastRSS is free open-source software (GNU/GPL), this plugin has a BSD license
Instructions:
- Create the cache directory – wp-content/aggrss-cache – and make it world writeable (chmod 777)
- create subdir wp-content/plugins/lastRSS
- Extract lastRSS.zip and save lastRSS.php in wp-content/plugins/lastRSS
local copy: lastRSS.0.9.1.zip (2.9 KiB, 2,636 downloads) - Save aggrss.php.txt (4.4 KiB, 2,483 downloads) as aggrss.php in your wp-content/plugins directory
- Activate the plugin from the Plugins page (re-activate (deactivate + activate) if you are upgrading aggrss)
Use:
$rs = aggrss($rssurl,$striptags=false,$num=0); /* $rssurl, url to the rss optional parameters: $striptags, if true all html tags will be remove from decriptions. $num, defines the number of records you want to display, $num=0 equals all available */
aggrss returns the rss content as an associative array with RSS fields, see sample below.
if ($rs = aggrss('http://soderlind.no/feed/rss2/')) {
// dump the structure
//echo "<pre>";
//print_r($rs);
//echo "</pre>";
echo "<h2><a xhref='" . $rs[link] . "'>" . $rs[title] . "</a></h2>";
echo $rs[description] . "<br />";
foreach ($rs['items'] as $item) {
echo "<p><a xhref='" .$item['link']. "'>" . $item['title'] . "</a><br />" .html_entity_decode($item['description']). "</p>";
}
if ($rs['items_count'] < = 0) {
echo "Sorry, no items found in the RSS file
"; }
} else {
echo "<!-- It's not possible to reach RSS file -->";
}
}



Pingback: Open Artifact » lastRSS
Pingback: FuturaWorkz » WordPress Aggregator
Pingback: a.css » Intčrpret RSS pel WordPress
28.9.2004 at 18:03
This looks really cool. I’m just a little confused about implementing it. After I enable the plugin, what code do i use to put this in my index.php file? I tried using your example, but generates this error: Fatal error: Call to undefined function: get() in /path/to/wp-content/plugins/aggrss.php on line 119
28.9.2004 at 21:00
My fault, it should be Get (with a capital G), I’ve fixed it in the zip file
17.10.2004 at 18:04
This is *nice*! Thank you… it’s exactl what I was looking for. And it’s done just so incredibly simply…. graceful. Yay!
Just one thing for noobs like me and people using a GUI FTP client:
Rather than saying “Extract aggress.zip in wp-content/plugins,” you may want to note that the *contents* of the aggrss folder that is created when you unzip the file is what you want to upload to the plugins directory.
27.10.2004 at 21:09
i still get /path/to/wp-content/plugins/aggrss.php on line 119 error in the latest zip file~ help~
what happen to the get function? i cant get it to work?~
6.11.2004 at 1:16
If you’re using older versions of PHP, you may get fatal errors mentioning html_entity_uncode. The solution is here: http://pear.php.net/manual/en/package.php.php-compat.intro.php
8.11.2004 at 3:58
Great plugin! One question. Is it possible to display more than one feed? Thanks!
8.11.2004 at 17:09
Trevor: I had a look at your link (which Per, the author, kindly pointed me to) but unfortunately I’m still at a loss. Like the others, I’m getting “Call to undefined function: get()” on line 119; I just can’t work out why. Any ideas?
8.11.2004 at 22:13
Spikehead: You could do this:
$feeds = array ("http://soderlind.no/feed/rss2/", "http://slashdot.org/slashdot.rdf", "http://dwlt.net/tapestry/dilbert.rdf"); foreach ($feeds as $feed) { if ($rs = aggrss($feed,false,1)) { echo "<h2><a href='" . $rs[link] . "'>" . $rs[title] . "</a></h2>n"; echo $rs[description] . "<br />n"; foreach ($rs['items'] as $item) { echo "<p><a href='" .$item['link']. "'>" . $item['title'] . "</a><br/>" .html_entity_decode($item['description']). "</p>n"; } if ($rs['items_count'] <= 0) { echo "Sorry, no items found in the RSS file
"; }
}
else {
echo "<!-- Sorry: It's not possible to reach RSS file -->";
}
}
21.11.2004 at 8:29
I’m getting a 404 Not Found from the aggrss.php.txt URL you give:
http://soderlind.no/download/aggrss.php.txt
Is it still available somewhere? Thanks.
21.11.2004 at 15:55
Prentiss R: I’ve fixed the link, you should use this one.
21.11.2004 at 19:43
Thanks! I’m impressed — this beats some WordPress- and del.icio.us-specific plugins I’ve tried, although I guess those are more usable by people who don’t know PHP.
29.11.2004 at 11:34
I’m also getting the “Call to undefined function: get()” error. If you find a solution please let us know.
2.12.2004 at 18:47
I tried to install this and then also pased this code in the index.php page… all I get is a blank page with a header…. help!!
2.12.2004 at 18:50
ooops…
< ?php
$feeds = array ("http://soderlind.no/feed/rss2/", "http://slashdot.org/slashdot.rdf", "http://dwlt.net/tapestry/dilbert.rdf");
foreach ($feeds as $feed) {
if ($rs = aggrss($feed,false,1)) {
echo "
” . $rs['title'] . “n”;
echo $rs['description'] . “
n”;
foreach ($rs['items'] as $item) {
echo “
” . $item['title'] . “
” .html_entity_decode($item['description']). “
n”;
"; }
}
if ($rs['items_count'] < = 0) { echo "Sorry, no items found in the RSS file
}
else {
echo "< !– Sorry: It’s not possible to reach RSS file –>“;
}
}
?>
2.12.2004 at 18:52
I”ll get it right here….
$feeds = array (“http://soderlind.no/feed/rss2/”, “http://slashdot.org/slashdot.rdf”, “http://dwlt.net/tapestry/dilbert.rdf”);
foreach ($feeds as $feed) {
if ($rs = aggrss($feed,false,1)) {
echo “
” . $rs['title'] . “
n”;
echo $rs['description'] . “
n”;
foreach ($rs['items'] as $item) {
echo “
” . $item['title'] . “
” .html_entity_decode($item['description']). “
n”;
"; }
}
if ($rs['items_count'] < = 0) { echo "Sorry, no items found in the RSS file
}
else {
echo "< !– Sorry: It’s not possible to reach RSS file –>“;
}
}
3.12.2004 at 14:29
Ryan: Not sure what you mean, does it work or not ?
8.12.2004 at 19:33
Nice looking aggregator but is there any chance of getting proxy configuration? I have to work behind a university firewall and feeds from beyond the intranet just don’t make it.
Many thanks
9.12.2004 at 3:20
aggrss will support proxies as soon as lastRSS supports it. You’ll have to ask Vojtech Semecky (author of lastRSS) for when he plans to do this.
10.12.2004 at 2:54
Implimentation for Dummies!
I’m not sure the exact way to place the code into my WP. Talk to me like I’m a 3 year old, coz most of them have more sense than me! What exact code to I place exactly where, with what exact tags?
10.12.2004 at 17:34
I hade a problem with the RSS feed containing double-quotes in the description and that did not work well with the html_entity_decode() function. The solution was quite simple though:
I changed: html_entity_decode($item['description'])
to: html_entity_decode($item['description'], ENT_NOQUOTES)
That solved my problems.
11.12.2004 at 1:14
This is cool, but I think there should be instructions on how to implement it. I have no idea how to do this.
11.12.2004 at 22:22
Clark and Anon: You’ll find a sample with source at http://soderlind.no/aggrss-demo.php
Hopefully this sample combined with the installation information i enough information to get your implementation running.
11.12.2004 at 22:31
eric, hisyam et. al:
I think I found the reason you get the “Call to undefined function: get()” error (got it myself)
You have to include <?php wp_head(); ?> in the header for the plugin to work (see this sample)
11.12.2004 at 22:31
Thanks! Even one with a 3YO’s coding ability (ME) can figure it now.
4.1.2005 at 23:57
Thanks! This makes my Gallery CVS checkins page, and my Audioscrobbler songs display nicely
6.1.2005 at 17:45
I’m very happily using aggrss in a WP blog but I’m now trying to run it in a non-WP environment. At first it looked like aggrss and lastRSS don’t really rely on much infrastructure from WP to work, but now I’ve hit the “undefined get()” problem:
Fatal error: Call to undefined function: get() in /foo/bar/aggrss/aggrss.php on line 128
I can’t just call wp_head() as suggested above because that would require a whole mess of WP functions. Reading the code I can’t figure out [a] what the line in aggrss.php has to do with a missing get() function or [b] exactly what a call to wp_head() would accomplish.
The problematic line 128 is just:
if ($aggr = $lastRSS->Get($rssurl)) …
Why should PHP report the problem as a missing get() function in aggrss.php instead of something deeper in the bowels of lastRSS?
And a call to wp_head() evaluates to apply_filters(‘wp_head’, ”) which gets me into a twisty maze of WP internals that I don’t begin to understand (what are WP filters, anyway?).
So… Anybody have any ideas? It seems to me that aggrss would have an even broader range of potential applications if it could be cut loose from a dependancy on WP. Thanks for your suggestions!
7.1.2005 at 5:13
Okay, I think I’ve got it. I’m able to invoke aggrss and lastRSS from a non-WordPress environment as follows.
I have a file wp-borrowings.php (lovely name, I know) that contains just:
< ?
define('ABSPATH', dirname(__FILE__).'/');
function add_filter() {
// no-op placeholder function
return true;
}
function get_settings() {
// no-op placeholder function
return '';
}
function trailingslashit($string) {
if ( '/' != substr($string, -1)) {
$string .= '/';
}
return $string;
}
?>
And I set up the necessary initializations in my non-WP index.php file as follows:
require “aggrss/wp-borrowings.php”;
require “aggrss/lastRSS/lastRSS.php”;
require “aggrss/aggrss.php”;
initAggrss();
Since the dependence on WP is so minimal, maybe a future release of aggrss could remove them entirely?
2.2.2005 at 7:33
Thanks for the plugin! Worked like a charm for my forums, I am also trying to impliment it for my gallery feed as well. Gallery uses 2.0 and with the script you have it only parses the text. Can you show me how I can have it display linkable thumbnails as well?
Thank you for your time!
18.2.2005 at 0:29
HI ! I am doing some Ebay2Rss stuff with your greart script, Using the latest WP1.5 I get
Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in D:\WebSites\getaccess\ploeck\wp-content\plugins\lastRSS\lastRSS.php on line 159
Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in D:\WebSites\getaccess\ploeck\wp-content\plugins\lastRSS\lastRSS.php on line 201
with your demo script, all settings are in default mode…
Any ideas are appreciated , Googling and WordPress forums yield nothing THX !!!
18.2.2005 at 1:37
Sorry for double post, please delete.
A friend of mine solved my issue, it s PHP5 related, in PHP 5 the string lastBuildDate delivers nothing which is not allowed under PHP5. In order to deliver an empty result it has to be ‘ ‘
so in lastRSS.php it reads and works for me
//after line 156
if ($temp != ”) $result[$channeltag] = $temp; // Set only if not empty
)
//now there is
if ($result['lastBuildDate'] == ”) {
$dummytemp = ‘ ‘;
}
// Ende eingefĂĽgt.
if ($this->date_format != ” && ($timestamp = strtotime($dummytemp)) !==-1) {
// convert lastBuildDate to specified date format
$result['lastBuildDate'] = date($this->date_format, $timestamp);
}
And later….
// Strip HTML tags and other bullshit from TITLE
if ($this->stripHTML && $result['items'][$i]['title'])
$result['items'][$i]['title'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['title'])));
// If date_format is specified and pubDate is valid
// EigefĂĽgt von Guido Walter
//Reason Line 160
if ($result['items'][$i]['pubDate'] == ”) {
$dummyresult = ‘ ‘;
18.2.2005 at 1:45
Thank you Jonas for reporting this
27.2.2005 at 9:11
This is great, Per!
I’m not seeing anything in my aggrss-cache folder, though. I checked perms, and they should be okay. Not a huge problem at the moment (I’m grabbing feeds on my own server to display as a sidebar) but I’m going to want to use some external feeds soon.
27.2.2005 at 20:21
Michael, it’s my fault you don’t see anything in your cache. I did som testing and forgot to update the plugin.
this turns caching off:
$lastRSS->cache_dir = ”; /* RSSCACHE_PATH; */
change this to:
$lastRSS->cache_dir = RSSCACHE_PATH;
or download the plugin again. Thank you for reporting this.
15.3.2005 at 23:36
Great plugin, just what I need, I created a new page called, RSS feeds, gave it a new template instead of changing index.php and I’m getting the following page output:
if ($rs = aggrss(‘http://dwlt.net/tapestry/dilbert.rdf',false,1)) { // dump the structure //echo ”
“;
//print_r($rs);
//echo ”
“; echo ”
” . $rs[title] . ”
“; echo $rs[description] . ”
“; foreach ($rs['items'] as $item) { echo ”
” . $item['title'] . ”
” .html_entity_decode($item['description']). ”
“; } if ($rs['items_count']
23.3.2005 at 21:48
I’m bit of a php novice here. I’m trying to customize the output. How do I get the titles bulleted (tried list tags, didnt work)? Also, is there some way just to list the dateofthe post, not the title.
thanks in advance.
15.5.2005 at 2:27
I’ve followed all the examples but I still get an error of not being able to reach the RSS feed.
17.5.2005 at 10:08
18.5.2005 at 7:11
Stuart, you just pasted code into the admin page editor didn’t you? WP doesn’t invoke PHP put in through the admin page editor, it reproduces the code like you’ve seen. There are some plugins to fix that if you need to.
21.5.2005 at 0:30
Hi I am also a bit of a php novice…have the plug in installed, but not sure what the code I should put in my sidebar.php file is…If you could give me an example I would really appreciate it.
Thank you
Michael Cohen
22.5.2005 at 19:29
I’m a total php dummy and having a hard time trying to figure where to put what, so please bear with me.
Where exactly does the following code go?
$rs = aggrss($rssurl,$striptags=false,$num=0)
$rssurl, url to the rss
Pingback: Mi Blog Linuxero :) - Ańadir feed’s RSS en Wordpress
11.7.2005 at 4:07
Thanks for this. I am a 2 year old and it took me a while to realize that this code goes in the template (e.g., usually sidebar) accessed via WordPress Theme Editor rather than in individual posts (WordPress does not allow php in its posts although there are a couple plugins which promise to do that).
In any event I can get the feed to show only one item.
I used the code from the demo
http://soderlind.no/aggrss-demo.php
View Source:
http://soderlind.no/aggrss-demo.php.txt
I modified:
$rssurl = ‘http://dwlt.net/tapestry/dilbert.rdf';
if ($rs = aggrss($rssurl,false,1)) {
to
$rssurl = ‘http://americasroof.com/wp/rss2/';
if ($rs = aggrss($rssurl,false,0)) {
But I only get one entry instead of 20 which I expected with the “0″ option.
13.7.2005 at 6:25
Not only am two-year but apparently I’m also retarded. I should have used the code on the top. It works great. Thanks!
Pingback: MadsK (Mads Kristensen Boldsen) » Blog Archive » Implementeret RSS-agressor
3.8.2005 at 16:08
WryTerra here.
I’ve made an interesting hack for this that people may or may not be interested in.
Instead of :
if ($rs = aggrss(‘http://soderlind.no/feed/rss2/‘)) {
I use
Basically the idea is this, you have a number of URIs set up in an array called $feeds, this collates them then adds them together, sorts them by their published date and creates one combined feed (sort of like a livejournal friendslist).
The rest of the code is as normal. The result is a single, combined and date sorted RSS feed. The extra items (source and hosturl) are so you can put a “Via Source” link into the post somewhere if you want to so you know where all the stories come from when they’re coming out combined.
It works pretty well.
The 1st improvement I want to make is to set a limit to the $rs array to only get the first $limit items, which is easy.
The 2nd improvement I want to make is to grab the array of URIs from a catagory of links (RSS Feeds, for example) in Word Press, which is less easy but shouldn’t pose a challenge either.
12.8.2005 at 4:47
Hello,
In your source code demo you have this line:
In my version of wp there is no such file named “‘wp-blog-header.php’”. I see just a file header.php.
Does that mean I must change the above to:
Or am I missing something — such as a file named “‘wp-blog-header.php’”
Thanks,
Rowby
http://rowby.com/wordpress/
12.8.2005 at 4:49
For some reason the php portion of my above comment was left out.
Here is the line at the top of your code which seems a problem for me:
php require(‘wp-blog-header.php’
As I indicated, I don’t have a file with that name in my blog….
12.8.2005 at 4:53
Hi, One more question, do I need to download and install lastRSS library.zip in my blog?
Thanks
Rowby
12.8.2005 at 4:54
Nevermind my last comment, I see it is included….
12.8.2005 at 7:54
Ah I see the file now. It’s not in my templates folder, but in my main wordpress folder.
12.8.2005 at 8:02
In your dilbert example you have this line:
$rssurl = ‘http://dwlt.net/tapestry/dilbert.rdf';
With the documentation that you provide on this page…
$rssurl, url to the rss
…what would the generic url be? Something like:
$rssurl = “http://mywebsite.com/wordpress/wp-content/plugins/lastRSS/???????.???
Any clarification would be appreciated.
Thanks
8.9.2005 at 2:45
My error is the following:
Parse error: parse error, expecting `T_STRING’ or `T_VARIABLE’ or `T_NUM_STRING’ in C:\Inetpub\vhosts\weird-remnants.com\httpdocs\Index.php on line 7
All the index.php has is the implementing code. I’m at a loss on this one.
8.9.2005 at 9:31
Re: Parse error. Check if you have a space character after the last ?>
27.9.2005 at 13:54
I have a space character but I get the same error.
Thanks in advance
Pingback: Livet pĺ en pinne » Det var pĺ tiden.
5.10.2005 at 8:39
awesome
13.10.2005 at 17:12
PS, thanks for this plugin. i was able to get it to work with little problems and I am using the array. I do have one question though, no matter what I set $num equal to I only recive one item. Your demo is 1, and I have set mine to 3 and even 0 (for all) but nothing changes. Anyone else comment on this?
24.10.2005 at 20:51
PS, I was just checking abck to see if you had any comments / fixes for my problem of only having one item displayed for each feed I pull from. I am using the array and have five feeds I am using right now. However, each feed only gives me the first item when there might be 10 to display. I would like to see the first three, but I have not been successful in changing the $num value.
Thanks,
29.11.2005 at 14:32
I don’t understand following at all. I am new user.
Use:
$rs = aggrss($rssurl,$striptags=false,$num=0)
$rssurl, url to the rss
optional parameters:
$striptags, if true all html tags will be remove from decriptions.
$num, defines the number of records you want to display, $num=0 equals all available
aggrss returns the rss content as an associative array with RSS fields, see sample below.
Can anyone hlep me?
18.12.2005 at 0:45
I echo the last poster.
> Use:
>
> $rs = aggrss($rssurl,$striptags=false,$num=0)
>
> $rssurl, url to the rss
Use…….. meaning what exactly? Do I have to modify my base installation to do this? What is the code for? Why doesn’t the plug-in handle it? Why doesn’t the installation handle it? Am I supposed to add the code to another file? What file? Why?
I’m not a PHP programmer but I’m not new to programming by any means. If you like, I could improve the docs.
19.12.2005 at 13:15
truely amazing, its one thing that never went wrong the first time:)
Pingback: Rumore » Blog Archive » links for 2006-01-20
Pingback: lomara.org » Blog Archive » This is me celebrating
22.1.2006 at 4:01
I tried to look at the demo but only got:
Fatal error:
Call to undefined function:
aggrss() in /home/virtual/site1/fst/var/www/html/dilbert/index.php on line 14
22.1.2006 at 17:09
ups, forgot to active the plugin after upgrading to WP 2.0, Thank you for telling me
Pingback: kungfubonanza.com » Wordpress Plugins and Such
24.3.2006 at 3:10
Thanks so much!! This is perfect!
2.4.2006 at 14:13
Unfortunately the link to the lastRSS library is broken and I couldn’t find it anywhere with google
2.4.2006 at 14:42
You’ll find a copy of LastRSS 0.9.1 at http://soderlind.no/download/lastRSS.0.9.1.zip
Pingback: my Great Note » Blog Archive » Put del.icio.us on your blog
4.8.2006 at 21:36
Not sure if this is still checked, but I’m in quite the dillemma.
I have striptags off, but it seems to still kill all my html tags from the syndication.
if ($rs = aggrss(‘http://12.0.2.240/rchs/wp-rss2.php?cat=5',false,0))
Is my syntax correct?
thanks
3.4.2009 at 9:07
Is this better than FeedWordPress that I am using at http://www.blogcottage.com
5.4.2009 at 1:07
No sure, haven’t used feedwordpress