Create Short URL via TinyURL, Is.gd, Hex.io, Tr.im, Bit.ly API

Discussion in 'PHP' started by astkboy2008, Jan 6, 2010.

  1. #1
    Short URL is commonly used today for several reasons: avoid url garbling, take smallest space especially for long url which need to be posted at limited space format eg: twitter, also often used to manipulate user for specific purposes eg: hiding orginal url for phising and ads/affiliation links.

    There are many websites that provide shortening url services, tinyurl, bit.ly, hex.io are some of them, and as addition to my simple twitter, plurk and facebook api implementation, i have created a PHP script to create short url on the fly, currently support: tinyURL, bit.ly, is.gd, tr.im and hex.io, but you can easily add other providers.
    fast example
    <?php
    $url = 'http://forums.digitalpoint.com';
    echo ShortUrl::create($url,'trim');
    echo '<hr />';
    echo ShortUrl::create($url,'tinyurl');
    echo '<hr />';
    echo ShortUrl::create($url,'isgd');
    echo '<hr />';
    echo ShortUrl::create($url,'hexio');
    echo '<hr />';
    echo ShortUrl::create($url,'bitly','your_user_name','your_api_key');
    ?>
    
    PHP:
    see the files

     
    astkboy2008, Jan 6, 2010 IP