Home API Create a Truncated URL with Shor.tt or Fat.ly

Create a Truncated URL with Shor.tt or Fat.ly


We’ve talked about the need for branded short URL services in the past. However, using third-party tools to represent your business isn’t just about branding, it’s about preserving the integrity of your links and maintaining control over your data. There no reason why any business – large or small – shouldn’t invest in their own themed shortening service…and this is something we address with our partners during early consultations.

If the decision for branded truncation isn’t made, we make a number of domains available – primarily fat.ly and shor.tt. Because the URLs created by our own shorteners are only shared by our clients, all of which we heavily scrutinize ourselves, there’s a quality assurance in knowing that you’re not sharing your links with dodgy marketers and practitioner of questionable content.

We’ve played with different ways of working with caching URL results in the past and we were never particularly satisfied with the results. When using WordPress it’s usually necessary to store the results in the WP database. Outside of WP, however, it’s important to cache the results to ensure repeated requests aren’t made to the API for the same URL. As such, Simple Cache is required for the following functions.

The functions below will be reference a number of times in the future… most notably for Twitter related shortcodes that follow. The functions may be used with our own truncation tools or for the service we’ve established for your own business.

Create a Truncated URL

The first function is responsible for shortening a URL and returning a truncated link. It returns an array of the URL id, short URL, and original URL.

While the id, url, and long url are cached for future retrieval, it’s the truncated URL that is returned. The alias and password, if required, should be alphanumeric characters. The expiry should be in the format yyyy-mm-dd.

Alter Status of URL

To enable and disable your truncated link, use the following. A Boolean value is returned.

To disable a link, use $status = '0'. To enable, use $status = '1'.

Return Link Information

To return basic information on a truncated URL, use the following:

The function returns an array of URL data. Returns false if invalid.

Get URL Count

To return the count of an existing short URL, the following example function may be used.


  • Caching is prone to errors if data, or the data $atts array, isn’t consistent. All the functions described on this page are built into a client plugin that hosts an independent version of caching, and includes a control panel to set API Keys and other default values.
  • For those that have access to the API features of one of our shorteners but aren’t connected to our social system, the Simple Cache functions can be download and installed as a plugin.

Short URL for this post: http://shor.tt/2nPG


Please enter your comment!
Please enter your name here