10690 Posts in 2797 Topics by 1519 members
Jump to:If this is your first visit, you will need to register before you can post. However, you can browse all messages below.
| Page: 1 | go to end | Reply | |
| Author | Topic: restful service rss | 454 views |

10 June 2008 at 9:33pm
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" (http://doc.silverstripe.com/doku.php?id=restfulservice)
It works well if I use the rss feed in the example, but if I use another rss (for example http://www.euro2008.uefa.com/rss/index.xml), it returns nothing at all. Why is this?
Last edited: 10 June 2008 at 9:47pm

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

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.

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:
// 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.
| 454 views | |||
| go to top | Reply |