| Please fill in your comments below: | |||||||||
<?
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;
}
}
?>
John is lead developer of Blurtit.com, Qhub.com and other exciting Web projects.
|
| Macmillan Cancer Support |
|
| Become an Organ Donor! |
|
| Become a Blood Donor! |
|
| The Cyclists Defence Fund! |