RSS weather CFC

You most likely didn't notice but i have a new "pod" called "Weather". I got the idea this morning after reading this post at Flex-MX. Its generated from a RSS feed from If you want the code you can download it here or its below for you if you click on "more"
<cfcomponent hint="Return the weather">
      Author:       Andy Jarrett -
      Created:      20/08/04
      Desciption: Returns the weather for you area from a RSS feed
   <cffunction name="myWeather" returntype="struct" hint="Returns the weather from" >
      <!--- Basic vars needed --->

      <cfset var weatherRss = "">
      <cfset var weatherXML = "">
      <cfset var weatherToday = structNew()>
      <cfif NOT isDefined("application.weatherXML.lastParsed") OR NOW() GT dateAdd("H", 3, application.weatherXML.lastParsed)>
         <!--- Get feed --->
         <cfhttp url="#weatherRss#" method="GET"></cfhttp>
         <!--- You need to know the reason it was last parsed because you will get banned if you hit several times within the hour. --->
         <cfset application.weatherXml.lastParsed = NOW()>
         <cfset application.weatherXml.parsed = xmlParse(cfhttp.filecontent)>
         weatherXML = application.weatherXml.parsed;
         weatherToday.text =; =;
      <cfreturn weatherToday>

comments powered by Disqus