Here’s a method to read an RSS feed with ColdFusion. This will work in ColdFusion 8 and later.
Code walkthrough:
- Use CFFEED to read an RSS feed. This should return a Query object.
- If the result is a Query Object, loop through and display the items.
- If the result is not a Query Object, display an error message.
Brian,
Will this work with more than one RSS feed? If so, do you just place the feeds in a comma delimited string or what?
Thanks
Henry
You would need to repeat the process to read more than one feed. You could then do a Query of Queries UNION query to merge the two queries into one result set.
I’ve found since writing that article that it’s better to retrieve RSS feeds via AJAX since the CFFEED tag will delay processing of your page until the feed is retrieved. This can result in seriously slow load times.
Actually, I wrote a followup post some time ago about combining RSS feeds that may help you. I did it as an exercise to help me learn CFScript.
http://www.brilang.com/2012/01/combining-two-rss-feeds-in-cfscript/1125
Thanks man! This was exactly what I needed.