CFLib.org – Common Function Library Project

getTinyURL(theurl)

Last updated October 06, 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>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson