Created
June 1, 2011 14:26
-
-
Save neokoenig/1002384 to your computer and use it in GitHub Desktop.
Flickr1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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