Skip to content

Instantly share code, notes, and snippets.

@jbuda
Created March 19, 2013 13:46
Show Gist options
  • Save jbuda/5196217 to your computer and use it in GitHub Desktop.
Save jbuda/5196217 to your computer and use it in GitHub Desktop.
MangoBlog and Twitpic coldfusion
<cfset urlstring = 'http://twitpic.com/photos/jbuda' />
<cfhttp url="#urlstring#" method="get" />
<cfset rawUrl = toString(cfhttp.filecontent) />
<cfset pos = 1 />
<cfset imageArray = arrayNew(1) />
<cfset regexp = '>div class="profile-photo-img"<(.*?)>/div<' />
<cfset found = refindnocase(regexp,rawUrl,pos,true) />
<cfloop condition="pos lt len(rawUrl)">
<cfset found = refindnocase(regexp,rawUrl,pos,true) />
<cfset pos = found.pos[1] + found.len[1] />
<cfif found.len[1] eq 0>
<cfbreak />
<cfelse>
<cfset img = mid(rawUrl,found.pos[2],found.len[2]) />
<cfset arrayAppend(imageArray,img) />
</cfif>
</cfloop>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment