The bit.ly plugin interacts with the bit.ly api allowing you to easily shorten urls, decode short links (to determine where they point), and find out how many times a link has been clicked. It can also generate QR code images as opposed to standard links. Works with both bit.ly and j.mp links.
Use this function to get the short link for a particular URL. It creates bit.ly links by default, but works with j.mp api as well.
Additionally, you can return a qr code instead of a text link like so:
echo $bitly->shorten('http://google.com', $service='bit.ly', $qr=true);
This function will “expand” bit.ly or j.mp links and retrieve the long url that they point to.
Use this to get the click stats for bit.ly or j.mp links. By default it will get the number of clicks on just your short link. However, if you pass “global” after the link it will get the number of clicks from all links pointing to the long url (in this case sublantic.net). Additionally you can enter “both” and it will return an array inluding both user and global click stats.
$stats = $bitly->stats('http://bit.ly/grqpfX', $type='both'); $stats['user']; // User link clicks $stats['global']; // Global link clicks