Bitly class
bit.ly allows users to shorten, share, and track links (URLs). Reducing the URL length makes sharing easier.
Grab your copy
About
PHP Bitly is a (wrapper)class to communicate with bit.ly.
License
Bitly is BSD licensed.
Documentation
The class is well documented inline. If you use a decent IDE you'll see that each method is documented with PHPDoc.
Sites that use this class
Do you know a site that uses this class? Use the form below.
Comments
Add your comment
If you have some feedback, a remark or you just want to say something. Go ahead, use the form below.
Tijs Verkoyen wrote:
01/08/2009
Changelog since 1.0.0:
- corrected some documentation
- wrote some explanation for the method-parameters
waldo malqui silva wrote:
22/09/2009
ERROR : CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
Solution:
if ( ini_get('open_basedir') == '' ) {
$options[CURLOPT_FOLLOWLOCATION] = true;
}
Steve wrote:
24/09/2009
Hi
Great class, one question though. Should we be encoding URL's before passing into your shorten method as the bit.ly api requires encoded URL's?
If so it would be cleaner to do the encode within the method.
Steve wrote:
24/09/2009
Just looked at the code more closely and I see you do encode! My bad :)
gentax wrote:
30/09/2009
thanks guy!
that's a wonderful help!
great class
Bruce wrote:
18/10/2009
Great class. Just what I was looking for.
Thank you! :)
OrT wrote:
13/11/2009
Excellent work, and big thanks for the support
RaFaDeFiNe wrote:
17/11/2009
CURL: http://pastebin.com/mcede228
Mike wrote:
30/11/2009
echo $bitly->shorten('http://blog.verkoyen.eu/blog/p/detail/bit-ly-php-wrapper-class');
Now that only outputs the JSON, no more short URL. What happened?
Tijs wrote:
02/12/2009
@Mike: just ran all my tests again and no errors.
Martin wrote:
13/02/2010
I wan´t to set the publishToHistory to false.. But it won´t work. Could you please tell me, how I can stop it?
Tijs Verkoyen wrote:
16/02/2010
Changelog since 1.0.1
- each URL will be added into your history, removed the history parameter
gombile wrote:
27/02/2010
Thanks for your bitly api PHP class
Jamie wrote:
04/03/2010
Any idea why I'm getting this error?
Fatal error: Uncaught exception 'BitlyException' with message 'Invalid headers (403)' in /home/pcitshop/public_html/admin/twitter/bitly.php:177 Stack trace: #0 /home/pcitshop/public_html/admin/twitter/bitly.php(382): Bitly->doCall('shorten', Array) #1 /home/pcitshop/public_html/admin/includes/modules/update_product.php(146): Bitly->shorten('http://www.pcit...') #2 /home/pcitshop/public_html/admin/product.php(62): require('/home/pcitshop/...') #3 {main} thrown in /home/pcitshop/public_html/admin/twitter/bitly.php on line 177
I can't figure it out
thanks
Tom wrote:
27/03/2010
Hi,
Thanks for the class (although I can't use it yet)
Here's what I'm getting already with only the require_once line:
Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in bitly.php on line 37
Any ideas?
Thanks,
Tom
Tom wrote:
27/03/2010
Ok switched to php5, sorry about that :)
I still get these 2 errors though :
Warning: curl_setopt_array() [function.curl-setopt-array]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /include/bitly.php5 on line 144
Fatal error: Uncaught exception 'BitlyException' with message 'Invalid JSON-response' in /include/bitly.php5:204 Stack trace: #0 /include/bitly.php5(316): Bitly->doCall('errors', NULL) #1 /test.php5(11): Bitly->errors() #2 {main} thrown in /include/bitly.php5 on line 204
Thanks
Tijs wrote:
07/04/2010
Changelog since 1.0.2:
- implemented V3 of the Bit.ly API (not backwards compatible). If you need the older version, you can download it from http://classes.verkoyen.eu/modules/bitly/files/php_bitly_1_0_2.zip
Resideo.com wrote:
21/06/2010
Thanks a bunch! Your class was extremely easy to implement
sunny wrote:
30/08/2010
<a href="http://www.aupair-star.com/">P90X Workout DVD</a>
<a href="http://www.rolex-mens.com">rolex mens watches</a>
<a href="http://www.itunes-gift-card.net">redeem itunes gift card</a>
<a href="http://www.highwaytowatches.com">swiss replica watches</a>
<a href="http://www.watches-mens.com">mens watches</a>
<a href="http://www.cnaweb.net/product/fitness_programs/insanity.shtml">insanity workout DVD
price,insanity workout.com</a>
<a href="http://www.cnaweb.net/product/fitness_programs/turbofire.shtml">Turbo Jam Workout DVD,Turbo
Jam.com</a>
<a href="http://www.cnaweb.net/product/fitness_programs/turbofire.shtml">Turbo Fire Workout DVD,Turbo
Fire.com</a>
<a href="http://www.cnaweb.net/product/fitness_programs/body-gospel.shtml">Body Gospel Workout DVD,Body
Gospel.com</a>
<a href="http://www.cnaweb.net/product/fitness_programs/power90.shtml">Power 90 Workout DVD,Power
90.com</a>
<a href="http://www.cnaweb.net/product/fitness_programs/brazil_butt_lift.shtml">Brazil Butt Lift Workouts
DVD</a>
<a href="http://www.cnaweb.net/product/fitness_programs/best_sellers/slim_in_6.shtml">Slim in 6 Workout
DVD,Slim in 6.com</a>
<a href="http://www.cnaweb.net/product/fitness_programs/hip_hop_abs.shtml">Hip Hop Abs Workout DVD,Hip
Hop Abs.com</a>
sunny wrote:
30/08/2010
http://www.aupair-star.com/
http://www.rolex-mens.com
http://www.itunes-gift-card.net
http://www.highwaytowatches.com
http://www.watches-mens.com
http://www.cnaweb.net/product/fitness_programs/insanity.shtml
http://www.cnaweb.net/product/fitness_programs/turbofire.shtml
http://www.cnaweb.net/product/fitness_programs/turbofire.shtml
http://www.cnaweb.net/product/fitness_programs/body-gospel.shtml
http://www.cnaweb.net/product/fitness_programs/power90.shtml
http://www.cnaweb.net/product/fitness_programs/brazil_butt_lift.shtm
http://www.cnaweb.net/product/fitness_programs/best_sellers/slim_in_6.shtml
http://www.cnaweb.net/product/fitness_programs/hip_hop_abs.shtml