Advertisement
Guest User

Untitled

a guest
Jun 5th, 2011
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <cfset rssUrl = "http://feeds.nationalgeographic.com/ng/photography/photo-of-the-day/">
  2.  
  3. <cffeed action="read" source="#rssUrl#" query="entries" properties="info">
  4.  
  5. <!---
  6. <cfdump var="#info#">
  7. <cfdump var="#entries#">
  8. --->
  9. <cfset dir = expandPath("./ngg")>
  10. <cfif not directoryExists(dir)>
  11.     <cfdirectory action="create" directory="#dir#">
  12. </cfif>
  13.  
  14. <cfloop query="entries">
  15.     <cfset filename = hash(linkhref) & "." & listlast(linkhref, ".")>
  16.     <cfoutput>checking #filename#... </cfoutput>
  17.     <cfif not fileExists(dir & "/" & filename)>
  18.         <cfhttp method="get" getAsBinary="yes" url="#linkhref#" path="#dir#" file="#filename#">
  19.         downloading!<br/>
  20.     <cfelse>
  21.         skipped<br/>
  22.     </cfif>
  23. </cfloop>
  24.  
  25. Done.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement