Skip to content

Instantly share code, notes, and snippets.

@boughtonp
Last active August 29, 2015 13:58
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 boughtonp/9930604 to your computer and use it in GitHub Desktop.
Save boughtonp/9930604 to your computer and use it in GitHub Desktop.
Using JSoup on CF10 with input from CFHTTP
component
{
This.Name = "jsoup_with_cfhttp";
This.JavaSettings = { LoadPaths:["./jsoup-1.7.2.jar"] };
}
[jsoup jar file in same directory]
<cfhttp url="http://stackoverflow.com/questions/tagged/cfml%20or%20railo%20or%20coldfusion*" method="get">
<cfhttpparam type="url" name="sort" value="active" />
</cfhttp>
<cfscript>
jsoup = createObject("java","org.jsoup.Jsoup");
dom = jsoup.parse(cfhttp.FileContent);
content = dom.getElementById("content");
</cfscript>
<cfdump var=#content.html()# />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment