|
Project Information
Links
|
Services_TwitterImportantThis project is now an official PEAR package and has moved to PEAR repository. Please report all bugs using the PEAR Bugtracker. AboutServices_Twitter is a PHP PEAR package for interfacing with Twitter's API. Specifically, it's an interface for the HTTP-Auth API and not the Jabber API. Installation
ExampleUpdating Status<?php
require_once 'Services/Twitter.php';
$user = 'YourUsername';
$pass = 'YourPassword';
$update = '@joestump ' . $user . ' is playing with Services_Twitter.';
try {
$twitter = new Services_Twitter($user, $pass);
$res = $twitter->statuses->update($update);
} catch (Services_Twitter_Exception $e) {
echo $e; // Services_Twitter_Exception::__toString() outputs a message
}
?>Get User Info<?php
require_once 'Services/Twitter.php';
$user = 'YourUsername';
$pass = 'YourPassword';
try {
$twitter = new Services_Twitter($user, $pass);
// Get foo's information
$res = $twitter->users->show('foo');
print_r($res);
// Get foo's information using foo's email address
$res = $twitter->users->show('foo@example.com');
print_r($res);
} catch (Services_Twitter_Exception $e) {
echo $e; // Services_Twitter_Exception::__toString() outputs a message
}
?>
|