Skip to content

Instantly share code, notes, and snippets.

@neokoenig
Created June 1, 2011 14:26
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 neokoenig/1002384 to your computer and use it in GitHub Desktop.
Save neokoenig/1002384 to your computer and use it in GitHub Desktop.
Flickr1
<cfsilent>
<!---Flickr Params--->
<cfparam name="flickr" default="http://www.flickr.com/services/rest/" />
<cfparam name="key" default="Your API Key Here" />
<cfparam name="userid" default="Your User ID Here">
<!---url.reinit used to manually refresh-->
<cfparam name="url.reinit" default="">
<!--- Do we have this value? --->
<cfif not isDefined("application.FlickrXml") OR len(url.reinit)>
<!---Send my Request to Flickr: this will get an XML doc with all my public photosets--->
<cfhttp url="#flickr#">
<cfhttpparam name="api_key" type="url" value="#key#" />
<cfhttpparam name="method" type="url" value="flickr.photosets.getList" />
<cfhttpparam name="user_id" type="url" value="#userid#" />
<cfhttpparam name="per_page" type="url" value="15" />
</cfhttp>
<!---parse the XML doc--->
<cfset application.FlickrXml = XmlParse(CFHTTP.FileContent) />
</cfif>
<!---Is XML request returned properly?--->
<cfif LCase(application.FlickrXml.XmlRoot.XmlAttributes['stat']) EQ "ok">
<cfelse><cfoutput>Failed</cfoutput><cfabort>
</cfif>
<!---Set the time this was done--->
<cfset application.FlickrXmlstarted=Now()>
<!---Parse/narrow down the info I need into an Array--->
<cfset photosets=XMLSearch(application.FlickrXml, '/rsp/photosets/photoset')>
</cfsilent>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment