noelg / php-twitter

A minimalist PHP Twitter API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A minimalist PHP Twitter API.
Inspired by Mike Verdone's <http://mike.verdone.ca> Python Twitter Tools


Public (unauthenticated) methods:

$twitter = new Twitter;

// Get the public timeline.
$entries = $twitter->statuses->public_timeline();

// Search.
$twitter->search(array('q' => 'foo'));


Protected (authenticated) methods:

$twitter = new Twitter('username', 'password');

// Get page two of the user's followers.
$entries = $twitter->statuses->followers(array('page' => 2));

// Send a direct message.
$twitter->direct_messages->new(array('user' => 12345, 'text' => 'foo'));

// View your lists. (Unfortunately, Twitter has adopted an inconsistent way 
// of exposing the list resources that doesn't quite fit our model.)
$twitter->{'username'}->lists();


Retrieving results in another format and setting the user agent string:

$twitter = new Twitter('username', 'password', array(
    'format' => "xml", 
    'user_agent' => "my-application/0.1"
));

-or-

$twitter = new Twitter;
$twitter->set_option('format', "XML");
$twitter->set_option('user_agent', "my-application/0.1");

About

A minimalist PHP Twitter API.


Languages

Language:PHP 100.0%