Skip to content

Instantly share code, notes, and snippets.

@cfjedimaster
Created April 6, 2012 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cfjedimaster/2319699 to your computer and use it in GitHub Desktop.
Save cfjedimaster/2319699 to your computer and use it in GitHub Desktop.
index.cfm
<!--- cache it to speed it up --->
<cfif not cacheIdExists("cnnhtml")>
<cfhttp url="http://www.cnn.com">
<cfset cnnhtml = cfhttp.filecontent>
<cfset cachePut("cnnhtml",cnnhtml)>
<cfelse>
<cfset cnnhtml = cacheGet("cnnhtml")>
</cfif>
<cfscript>
jsoup = createObject("java", "org.jsoup.Jsoup");
doc = jsoup.parse(cnnhtml);
links = doc.select("img");
</cfscript>
<cfloop index="e" array="#links#">
<cfoutput>
#e.attr("src")# --- Title: #e.attr("title")# --- Alt: #e.attr("alt")#<br/>
</cfoutput>
</cfloop>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment