CFLib.org – Common Function Library Project

getTinyURL(theurl)

Last updated October 6, 2008

author

Todd Sharp

Version: 1 | Requires: CF5 | Library: UtilityLib

Description:
Pass a URL and the UDF will return a tinyurl (http://tinyurl.com).

Return Values:
Returns a String containing the tinyurl.

Example:

<cfdump var="#getTinyURL("http://cflib.org")#">

Parameters:

Name Description Required
theurl The URL that you would like to convert to a tinyurl. Yes

Full UDF Source:

<!---
 Quick and easy way to get a tinyurl.
 
 @param theurl 	 The URL that you would like to convert to a tinyurl. (Required)
 @return Returns a String containing the tinyurl. 
 @author Todd Sharp (todd@cfsilence.com) 
 @version 1, October 6, 2008 
--->
<cffunction name="getTinyURL" access="public" output="false" returntype="string">
	<cfargument name="theurl" required="true" type="string" />
	<cfset var apiURL = "http://tinyurl.com/api-create.php?url=" & URLEncodedFormat(arguments.theurl) />
	
	<cfhttp url="#apiURL#" />
	
	<cfreturn cfhttp.FileContent />
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson