Subscribe
Free Knowledge in an RSS feed

Short URL generator / Referrer hider

Article published Thursday, October 15th, 2009 at 11:00 am

There are dozens of sites out there which offer the service of generating shorter links using their domains as a middle man which then redirect to a different domain. Unfortunately, none of them allow you to generate links programmatically. Or, if you can find a site with enough holes to allow you to do so, they will revoke permissions from the server making the connections.

Until now.

ezLINK.info has an easy to work with API for generating shorter links. Why might someone want to create shorter links? For one thing, long URLs with tons of GET based information can be cumbersome to work with, especially manually. Another reason is that for various reasons you may not want the end user to see the location they are being linked to (perhaps the URL contains informaiton that the user shouldn’t be able to play around with). The third reason is that many sites don’t like the destination site to know where traffic is coming from. Whenever you link to a website, statistics about a user is collected including the site where the user came from.

How does one use the ezLINK.info service using PHP? It’s really simple. The following is the code offered by the website:

$longurl = "http://www.example.com/location.php?asdf=jkl";
$handle = fopen("http://ezlink.info/api.php?url=$longurl", "rb");
$shorturl = stream_get_contents($handle);
fclose($handle);
echo $shorturl;

How it works: $longurl contains the URL you would like to mask. Once the code is executed, $shorturl contains the new URL from the ezLINK database. Simple, huh?

Tags: ,

One Response to “Short URL generator / Referrer hider”

  1. CHUA says:

    how it works ? i dont know, please describe…

Leave a Reply