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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Issue with RSSFeed, RestfulService and getValues


Reply


4 Posts   1006 Views

Avatar
Tama

Community Member, 130 Posts

27 August 2010 at 3:08pm

Howdy

I'm using RestfulService to get RSS feeds from internal website to integrate into our website:

function RestfulLinks($url, $delimiter, $interval){
   $rssfeed = new RestfulService($url,$interval);
   $conn = $rssfeed->request('')->getBody();
   $result = $rssfeed->getValues($conn, $delimiter);
   return $result;
}

This work for Atom feeds using "entry" as a delimiter like this one: http://itson.co.nz/feeds/all/

But when I try to use it to access a bog standard RSS feed using "item" as delimiter it fails. Here's an example (Silverstripe) feed it's failing on: http://www.nelsontasmancivildefence.co.nz/news/rss

The RSS feeds are coming through fine and if I use "channel" as a delimiter it pulls through the channel information.

This would suggest that the problem is around

getValues($conn, $delimiter)

Does anyone have any ideas why this would be happening? I'm on SS2.4

Cheers
Tama

Avatar
Tama

Community Member, 130 Posts

31 August 2010 at 8:35am

A bit of a bump here.

Am I the only person who's run into this issue?

Avatar
Tama

Community Member, 130 Posts

22 September 2010 at 11:55am

I found the problem. I had based my code on this example: http://doc.silverstripe.org/restfulservice#how_to_use_restfulservice_to_easily_embed_an_rss_feed

However getValues() has been updated and now takes 3 values instead of 2: http://api.silverstripe.org/2.4/sapphire/integration/RestfulService.html#methodgetValues

So the correct line is:

$result = $rssfeed->getValues($conn, 'channel', $delimiter);

ARGH!!!!!

Avatar
davidm2010

Community Member, 107 Posts

13 October 2010 at 7:39am

I've been using Google's API and I am able to use it in the editor.