Using RSS as an API Sep25 '07
In my last post, I discussed how to parse an RSS feed with PHP, and display the contents directly on your site.
The advantages of using a server-side programming language to parse an RSS feed are:
- The content is obtained as the page is being served, meaning there is no additional delay for end-viewers.
- You can format the content to fit into your existing HTML markup.
The disadvantages of Flash and JavaScript "widgets" are:
- Sloppy-looking, blocky, hard to customize, and often break site layouts.
- Pull content after the page has loaded, meaning there is an additional "wait time" as the client browser reaches out to the remote URL's.
- Invisible to search engines, meaning they offer no additional page-rank value to your site.
RSS as an API
In a sense, an RSS feed is an API. On systems where you don't have direct access to the server or database, using the public RSS feed is the only way to obtain the content for use elsewhere.
The main drawback to using an RSS feed as an API is you are limited to whatever is in the RSS feed, meaning if the feed only displays 10 posts, you can only obtain 10 posts. Most RSS feeds have a limit of how many items are displayed. This site has over 1,000 blog posts. However, my RSS feed only displays the 10 most recent.
It would serve me no purpose to offer a feed that contains every post. I can imagine it would only cause the file to be extremely large, slowing down feed readers' response time when trying to access my feed for subscribers.
However, offering a "flag" on the feed itself could be useful. In other words, here's the RSS feed for this site:
http://matthom.com/feed/matthom.xml
This pulls the 10 most recent posts. What if a user wanted to write an application using my data, but needed access to every post? I could provide a "flag" or "parameter" for them to supply:
http://matthom.com/feed/matthom.xml?count=all
The variable count could be set to any number, or "all" for all posts.
It might be wise to consider authenticating the "all" feed, and providing access to individuals as you see fit.
Add Feedback (view all)
Leave feedback
matthom
is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from Chicago.
Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.
- Use PHP to display any RSS feed on your site
- Adobe On Air Bus Chicago event
- Football weekly blame game
Similar Entries
- RSS Best Practices? (4 recent visits)
- What are your RSS opinions? (2 recent visits)
- New RSS feed – Bulls game alerts (1 recent visits)
- Filtered Lifehacker RSS feed using Yahoo! Pipes (54 recent visits)
- Web site stats via email or RSS (6 recent visits)
- Digg will eventually replace my RSS subscriptions (5 recent visits)
Stats
5 unique visits since August 2008
Recent Referrers (click)
- http://matthom.com/archive/200
- http://matthom.com/archive/200
- http://matthom.com/archive/200
- http://matthom.com/archive/200
- using
- http://matthom.com/archive/200
- http://matthom.com/archive/200
- http://matthom.com/archive/200
- http://matthom.com/archive/200
- using
- http://matthom.com/archive/200
- http://matthom.com/archive/200
- http://matthom.com/archive/200
- http://matthom.com/archive/200
- using
- http://matthom.com/archive/200
- http://matthom.com/archive/200