I'm looking at pulling an RSS feed from one site and displaying it on another... the source site is WP and the target site is HTML/CSS...

Looking for best practices, not just a solution.

5 answers

o.k.w 2355

RSS (including the various versions/variants) is essentially XML. One method is to use a XSLT to format it to an XHTML (or HTML). There's the most straightfoward without actually getting your hands dirty doing coding/programming.

Having said that XSLT can be a real pain itself. You probably want to get a working version and modify from there.

Here are a few references:
Parsing RSS with XSLT
Making RSS Pretty
XML-XSLT-RSS cheat sheets
Adding an XSL StyleSheet to your RSS Feed
Processing RSS Files with XSLT
and more...

Answered over 9 years ago by o.k.w
danwellman 5600

Because browsers will not let you retreive data from another domain for security reasons you need to use a server-side proxy service. Basically, you bypass the cross-domain exclusion policy by making the request from your browser to your server-side app (tricking the browser into thinking the data is coming from your own domain). The server-side app retrieves the data (and parses it ideally) before passing it back to the browser for your to proces on the client side.

Alternatively you could use Yahoo Pipes which will retrieve the RSS for you, parse it and convert it to JSON and then return it to you. Pipes acts as the proxy between you and the feeds you want to consume. It is really easy to setup and use and the resulting JSON can be parsed with jQuery very easily.

Answered over 9 years ago by danwellman
  • Yahoo Pipes is a bit old, as a technology. The new version is Yahoo Query Language (YQL), which is more like SQL statement. http://developer.yahoo.com/yql/ YQL has specific support for RSS in its data.rss module and can be easily experimented with via YQL console. I played with YQL at Yahoo Hack event and while it still has lots of room to grow, it is very impressive for getting things done quickly. Alexandre Rafalovitch over 9 years ago
Doug 1095

Not much in the way of best practices other than: do it server-side, use a library, and give credit. Server-side to avoid all the hassles danwellman points out (plus why make the browser do work the server should). Library because: don't reinvent the wheel. And if you're displaying someone else's content in your site, give credit (don't steal).

If you're coding in PHP, the best library I've used is SimplePie.

Answered over 9 years ago by Doug

I don't steal content. The content is actually my own, just looking to be able to update one site from another (my own) RSS. Thanks for the suggestions. I'll look into these options and then let you know which I've decided on.

Answered over 9 years ago by Not-a-Coder
  • I wasn't implying anything. Even if the content is not your own, it's not necessarily stealing. Doug over 9 years ago

Just found Google's AJAX Feed API that might be a perfect match for your needs. They even provide a builder to make it easier.

Answered over 9 years ago by Alexandre Rafalovitch