PHP Bit.ly Plugin

top ad

LIVE PREVIEWBUY FOR $6

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.

Shorten 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.

echo $bitly->shorten('http://google.com');

Result: http://bit.ly/grqpfX

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);

Result

Expand Links

This function will “expand” bit.ly or j.mp links and retrieve the long url that they point to.

echo $bitly->expand('http://bit.ly/grqpfX');

Result: http://google.com

Bitly Stats

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

Result

Clicks on http://bit.ly/grqpfX: 3
Clicks on all links pointing to http://google.com: 1483

More Files From the PHP Plugin Suite


Image Plugin


Twitter Plugin


Video Plugin


Weather Plugin


Map + Weather Plugin

pose css

bottom ad
Source

Add a Comment

Your email address will not be published. Required fields are marked *