Archive for the ‘APIs’ Category

Shorten URLs with Zend Framework and bit.ly

Thursday, August 26th, 2010

This function uses version 3.0 of the bit.ly API. You'll need to register for an account with them if you don't already have one. Then you can retrieve your API key and begin using it immediately. {code type=php} function bitlyShorten($url) { $client = new Zend_Http_Client('http://api.bit.ly/v3/shorten'); $client->setParameterGet(array( 'longUrl' => $url, 'login' => 'xyz', 'apiKey' => 'xyz' )); $response = $client->request(); if($response->isSuccessful()) { $response = ...