Getting an RSS Feed in ColdFusion with CFHTTP

Here’s a method to get an RSS feed with ColdFusion. This will work in ColdFusion 7 and later.

Code walkthrough:

  • Use CFHTTP to generate an HTTP request and handle the response from the server. This should return XML.
  • Use XMLParse to attempt to convert the CFHTTP.FileContent response into an XML document object.
  • If the result is an XML Document, loop through and display the first six items.
  • If the result is not an XML Document, display an error message.

http://pastebin.com/embed_iframe.php?i=pHQPRx8B

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s