| Subcribe via RSS

Join the Black Hat Digest Newsletter

Get On The Site Creation Waiting List
Have a new website delivered to you every month! Read more...

Convert Url to Tiny Url

December 22nd, 2009 Posted in Tutorials

Sometimes you need to convert a url to a new one on the fly.  Tinyurl offers a very easy to use API to do that.  You can do it complicated with curl or you can just use file_get_contents and make it a one line function.

function ShortURL($ToConvert) {
$short_url= file_get_contents(“http://tinyurl.com/api-create.php?url=” . $ToConvert);
return $short_url;

}

Just call it with:

$newurl = ShortURL(‘http://www.linktoshorten.com/itsreallylong’);

Cash in on your Competitors’ Work – SpyFu Ad History

Popularity: 1% [?]

Leave a Reply