Skip to content

Instantly share code, notes, and snippets.

@RichardDavies
Created November 18, 2009 19:50
Show Gist options
  • Save RichardDavies/238184 to your computer and use it in GitHub Desktop.
Save RichardDavies/238184 to your computer and use it in GitHub Desktop.
After the Deadline ColdFusion proxy
<!--- After the Deadline Proxy Script
ColdFusion port by Richard Davies - http://www.richarddavies.us
Version 1.0
--->
<cfsetting showdebugoutput="false" />
<!---
You get the option of hardcoding your API key here. Do this if you don't want people seeing
your key when they do View -> Source.
--->
<cfset API_KEY = "43ba440eef01cdf46263d53e467fc800" />
<cfif CGI.REQUEST_METHOD is "POST">
<cfset postText = Trim(GetHttpRequestData().content) />
<cfelse>
<cfabort />
</cfif>
<cfif Len(API_KEY)>
<cfset postText = REReplace(postText, "&key=[a-zA-Z0-9]*", "") />
<cfset postText = "#postText#&key=#API_Key#" />
</cfif>
<cfset rpcURL = Url.url />
<cfhttp url="http://service.afterthedeadline.com#rpcURL#" method="post" useragent="AtD/0.1" timeout="10" result="cfhttp">
<cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded" />
<cfhttpparam type="body" value="#postText#" />
</cfhttp>
<cfcontent type="text/xml" />
<cfoutput>#cfhttp.FileContent#</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment