<?
class twitter {
function twitter($username,$password) {
$this->username=$username;
$this->password=$password;
$this->baseurl = "http://twitter.com/";
}
function tweet($message) {
# status
$url = $this->baseurl."statuses/update.xml";
$session = curl_init();
curl_setopt ( $session, CURLOPT_URL, $url );
curl_setopt ( $session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_setopt ( $session, CURLOPT_HEADER, false );
curl_setopt ( $session, CURLOPT_USERPWD, $this->username . ":" . $this->password );
curl_setopt ( $session, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $session, CURLOPT_POST, 1);
curl_setopt ( $session, CURLOPT_POSTFIELDS,"status=" . $message);
$result = curl_exec ( $session );
curl_close( $session );
print $result;
}
}
?>