Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

restful service rss

Go to End

4 Posts   4272 Views


Community Member, 53 Posts

10 June 2008 at 9:33pm

Edited: 10/06/2008 9:47pm

Hi, I'm trying to import and display an external rss-feed, as in the example code on "How to use RestfulService to easily embed an RSS feed" (

It works well if I use the rss feed in the example, but if I use another rss (for example, it returns nothing at all. Why is this?


Forum Moderator, 5523 Posts

11 June 2008 at 1:58pm

The blog modules RSS Feed widget uses SimplePie. I dont know how it differs from RestFulService it terms of what you actually want to do but that uses something like


49 Posts

1 December 2008 at 8:30am

I have the same problem as superautomatic. Got it working as described in the documentation, with help from the comments. But it only works with that feed, none else.

I can't seem to get the http://mypage/PageComment/rss/ feed working either. It says that Xml- or textdeclaration not in beginning of entity. Any clues on that?

Besides that there is a typo in RestfulService.php, in line 134. $respnoseBody should be $responseBody I suppose.


121 Posts

1 December 2008 at 9:35pm

With 2.3 coming up I decided to use the RestfulService.php from the 2.3 branch instead of the current stable one, and as it is pretty self contained it seems to work fine on 2.2.3.

The problem I had was with the difference in format between RSS feeds of different versions: RSS 1.0 places the <item> tags outside the <channel>, while RSS 2.0 places them outside. The end result of this is that you need to call getValues slightly differently, here's a snippet of code that I wrote for a recent site:

    function Items($limit = 3) {
      if(!$this->Link) return 0;
      $feed = new RestfulService($this->Link);
      $feedXML = $feed->request()->getBody();

      // Extract items from feed
      if($this->Type == 'RSS2') {
        $result = $feed->getValues($feedXML, 'channel', 'item');
      } elseif($this->Type == 'RSS1') {
        $result = $feed->getValues($feedXML, 'item');

      // Return items up to limit
      return $result->getRange(0,$limit);

Hope that helps.

BTW I've posted a patch to Trac that re-enables the response caching as I couldn't live without it for this site. Not sure whether it's good enough for inclusion in trunk though.