Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <!--- Use cfhttp to GET an RSS feed (CF7 and up) --->
  2. <cftry>
  3.     <cfhttp
  4.         url="http://path.to/feed"
  5.         method="GET" resolveurl="yes" timeout="10">
  6.     </cfhttp>
  7.     <cfset Feed = XMLParse(CFHTTP.FileContent)>
  8.     <cfcatch type="any"><!--- An error occurred --->
  9.         <cfset Feed = "">
  10.     </cfcatch>
  11. </cftry>
  12.  
  13. <!--- Use cfdump to display the result xml to fine tune what you want to output --->
  14. <cfdump var="#Feed#">
  15.  
  16. <!--- Use this to output the resulting feed wherever you want --->
  17. <cfif isDefined("Feed") AND isXMLDoc(Feed)>
  18. <!--- Output 6 items from the feed (assumes there's at least 6 items) --->
  19. <cfloop index="x" from="1" to="6"><p><cfoutput>
  20.     <a href="#Feed.rss.channel.item[x].link.xmlText#">
  21.         #Feed.rss.channel.item[x].title.xmlText#
  22.     </a><br />
  23.     <small class="nowrap">#DateFormat(Feed.rss.channel.item[x].pubDate.xmlText, 'mmm d, yyyy')#</small>
  24. </cfoutput></p>
  25. </cfloop>
  26. <cfelse>
  27.     <p>Feed is temporarily unavailable.</p>
  28. </cfif>