<cffunction name="shortify" output="false" returntype="string">
	<cfargument name="srcUrl" type="string" required="true" />
	<cfargument name="custom" type="string" default="" />
	<cfargument name="preview" type="boolean" default="false" />
	<cfset var cfhttp = "" />
	<cfset var xml = "" />
	<cfhttp url="http://api.urlms.com/"
		method="post"
		result="cfhttp">
		<cfhttpparam type="formfield" name="url" value="#srcUrl#" />
		<cfif len(trim(custom)) GT 0>
			<cfhttpparam type="formfield" name="pointer" value="#trim(custom)#" />
		</cfif>
		<cfif preview>
			<cfhttpparam type="formfield" name="preview" value="true" />
		</cfif>
	</cfhttp>
	<cfreturn cfhttp.fileContent />
</cffunction>

<cfoutput>
<pre>#htmlEditFormat(shortify('http://barneyb.com/1'))#</pre>
<pre>#htmlEditFormat(shortify('http://barneyb.com/2', '4'))#</pre>
<pre>#htmlEditFormat(shortify('http://barneyb.com/3', '3', true))#</pre>
<pre>#htmlEditFormat(shortify('http://barneyb.com/5', 'BsK'))#</pre>
<hr />
<pre>#htmlEditFormat(fileRead(getCurrentTemplatePath()))#</pre>
</cfoutput>