Consuming Flickr RSS feed using ColdFusion

The following code will make a http request for a Flickr RSS feed, and output the results. You may want to cfdump the XMLContent variable to see what other values you can use from the feed. Enjoy...

<cfhttp url="http://api.flickr.com/services/feeds/groups_pool.gne?id=77561358@N00&format=rss_200" method="GET"></cfhttp>
<cfscript>
XMLContent = trim(cfhttp.filecontent);
XMLContent = XMLParse(XMLContent);
</cfscript>
<cfloop from="1" to="#ArrayLen(XMLContent.rss.channel.item)#" index="idx">
<cfoutput>
Link to Flickr: <a href="#XMLContent.rss.channel.item[idx].link.xmlText#">#XMLContent.rss.channel.item[idx].title.xmlText#</a><BR>
Image: <img src='#XMLContent.rss.channel.item[idx]["media:thumbnail"].xmlattributes.url#'><BR>
Author: #XMLContent.rss.channel.item[idx].author.xmlText#<BR>
Date: #XMLContent.rss.channel.item[idx].pubDate.xmlText#
</cfoutput>
<hr>
</cfloop>

Here is a demo of this in action.

Comments
Mark Aplet's Gravatar Thanks for the code snippet Troy. I tried 4 other possible solutions before finding yours. Yours was the only one that worked for me.
# Posted by Mark Aplet | 9/28/08 11:45 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner