27 juli 2009

Bit.ly PHP Wrapper class

Seems like TinyUrl is still too long... So I wrote wrapperclass to communicate with another url-shortening-service, called: bit.ly

Go grab your copy: http://classes.verkoyen.eu/bitly

Dit artikel gaat over: , , , , . Bit.ly PHP Wrapper class werd geschreven door Tijs Verkoyen.
Er zijn al 5 reacties.

Reacties

Pete

Pete schreef:
29/07/09

Y'know, your timing is perfect.

I just thought of integrating your Twitter class into a news posting system on one of our websites to automatically Tweet about news and was going to look at the bit.ly API docs and now I don't have to!

Thank you VERY much :)

Tijs

Tijs schreef:
29/07/09

You're welcome

Paul Matthews

Paul Matthews schreef:
31/07/09

Hi

Think there may be a problem in the Twitter wrapper with using (int) to cast the $sinceId values, because the Twitter IDs are now past the maximum int size of 2 billion or so.

E.g. I was using getReplies, and think I have fixed the problem by casting the sinceId to a float instead of an int on line 612

Love the class BTW!

Paul

Tried to post this on your twitter API page, but got an error "something went wrong" !!

ian_scho

ian_scho schreef:
04/09/09

Thanks Tijs, will use your class if the basic file_get_contents doesn't work!

$url_final = "http://www.google.es";
$urlBitly = 'http://api.bit.ly/shorten?version=2.0.1&login=usernamehere&apiKey=R_longrandomstring=';
$output = file_get_contents($urlBitly . urlencode($url_final));
$json = json_decode($output, true);
if ($json && $json['errorCode'] == '0') {
$new_url = $json['results'][$url_final]['shortUrl'];

matt kaufman

matt kaufman schreef:
07/01/11

thanks,

opposite can be made too to expand urls.

Reageer velden gemarkeerd met een sterretje zijn verplicht

*