Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Generate Short Bitly Url

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 295
    Comment on it

    Here's how you can create short URLs using Bit.ly services

    /* returns the shortened url */ 
    function get_bitly_short_url($url,$login,$appkey,$format='txt')
    {
    $connectURL = 'http://api.bit.ly/v3/shorten?login='.$login.'&apiKey='.$appkey.'&uri='.urlencode($url).'&format='.$format;
    return curl_get_result($connectURL);
    } /* returns a result form url */
    function curl_get_result($url)
    {
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
    } /* get the short url */ $tweet = get_bitly_short_url('URL','login_id','app_key');

    $tweet = urlencode($tweet);

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: