public static function make_bitly_url($url, $login = '', $appkey = 'R_f0b76fa0948d2cb9f223fb5387ad09ba', $format = 'xml')
    {
        // create the URL
        $bitly = 'http://api.bitly.com/v3/shorten?longUrl=' . urlencode($url) . '&login=' . urlencode($login) . '&apiKey=' . $appkey . '&format=' . $format;

        // get the url
        // could also use cURL here
        $response = file_get_contents($bitly);

        // parse depending on desired format
        if (strtolower($format) == 'json') {
            $json = @json_decode($response, true);

            return $json['results'][$url]['shortUrl'];
        } else // xml
        {
            $xml = simplexml_load_string($response);

            return Config::get('bitly_url') . $xml->data->hash;
        }
    }