My favorites | Sign in
Project Logo
    
Code license: New BSD License
Labels: php, pear, twitter, php5, api, twitterapi
People details
Project owners:
  jstump, izimobil, klimpong

Services_Twitter

Important

This project is now an official PEAR package and has moved to PEAR repository. Please report all bugs using the PEAR Bugtracker.

About

Services_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

  1. Install PEAR if it is not already installed on your system.
  2. Run pear install Services_Twitter.

Example

Updating 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
}

?>








Hosted by Google Code