It should also be noted that bitly.com is moving towards Oauth - so you can use this url for api_url instead:
https://api-ssl.bitly.com/v3/shorten?format=json&access_token=ACCESS_TOKEN&longUrl=
or this one for j.mp:
https://api-ssl.bitly.com/v3/shorten?format=json&access_token=ACCESS_TOKEN&domain=j.mp&longUrl=
Where "ACCESS_TOKEN" is an access token generated here: https://bitly.com/a/oauth_apps