Goo.gl URL shortener


Warning: sizeof(): Parameter must be an array or an object that implements Countable in /var/www/clients/client1/web1/web/wp-content/plugins/ad-injection/ad-injection.php on line 824

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/clients/client1/web1/web/wp-content/plugins/ad-injection/ad-injection.php on line 831

How to make shorten url using goo.gl

import urllib
import simplejson

def GooGL(url):
    params = urllib.urlencode({'security_token': None, 'url': url})
    f = urllib.urlopen('http://goo.gl/api/shorten', params)
    return simplejson.loads(f.read())['short_url']
>>> GooGL('http://www.google.com')
'http://goo.gl/mR2d'
>>>



coded by nessus