Robert Eisele
Systems Engineer, Architect and DBA

PHP twitter API

Attention: This library isn't maintained anymore. Twitter also restricted the API to work with OAuth only, so that this class won't work anymore!

I started too much OpenSource projects in the past. I try to publish all of them step by step here, because some of them are really cool. But for today, I have a new class for you. It is yet another a twitter API written in PHP. I must confess that the class becomes really complex because I tried to implement really every API method supported by twitter.

Why should you use this class? And what is so different to other API's. There are a few really good API's for twitter out there but I tried to combine the best things of all classes in this one and added a few own features. For example, the work on my previous class xColor has influenced me as I will show you in the example below. So your next project could be easily an online twitter designer or something else. But let's proceed with some snippets:

<?php

$xt = new xTwitter('roberteisele', '*********');
$xc = new xColor;

$base_color = '#44cc00';
$border_color = array(204, 0, 0); // #c00
$text_color = '333';

$xt->updateColors($base_color, $text_color, $border_color, $xc->opacity($base_color, '#fff', 20));

?>

I think the most important API method is the status update to publish a new tweet:

<?php

$message = 'Did you hear, there is a new twitter API for PHP: http://www.xarg.org/2010/02/php-twitter-api/';

$xt->updateStatus($message);

?>

With the more general method updateStatus() the new tweet will be shorten by removing long URL's using the URL shortener tr.im. Okay, I could continue bringing examples for every method, but read the source, read the documentation and enhance the functionality of twitter :)

You might also be interested in the following

2 Comments on „PHP twitter API”

S.Ali Hussain
S.Ali Hussain

where can i download xclass ???

Christian  D.
Christian D.

Hi there ....

Was wondering of you could provide some examples on the use of your class, and maybe some documentation . Or maybe perhaps point me in the right direction.

Thank you for your time.

Christian

 

Sorry, comments are closed for this article. Contact me if you have an inventive contribution.