Encontre una clase (que ya tiene buen tiempo en la web) de Antonio Lupetti que ultimamente he estado usando para el microblogging en Twitter. Bastará con tener instalado las librerias CURL (permite conexión y comunicación con varios tipos de servidores diferentes con varios tipos de protocolos diferentes) en PHP. He aquí la clase y la forma de usarlo en nuestro sitio web.

<?php
/*
File: twitter.php

Description:
The following class is for using twitter.com

This class was based off the work of Antonio Lupetti. Original Work can be found at:
http://woork.blogspot.com/2007/10/twitter-send-message-from-php-page.html

Contributing Author( s):
Antonio Lupetti < antonio.lupetti@gmail.com >
Scott Sloan < scott@aimclear.com >

Date: January 4th, 2008
License: Creative Commons

*/
class twitter {

private $user;
private $pass;
private $ch;
private $twitterHost = "http://twitter.com/";

public function __construct($username, $passwd) {
$this->user = $username;
$this->pass = $passwd;

/* Create and setup the curl Session */
$this->ch = curl_init();

curl_setopt($this->ch, CURLOPT_VERBOSE, 1);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_USERPWD, "$this->user:$this->pass");
curl_setopt($this->ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($this->ch, CURLOPT_POST, 1);
}

public function __destruct() {
/*clean Up */
curl_close($this->ch);
}

public function setStatus($stat) {

if(strlen($stat) < 1)
return false;

/*Set the host information for the curl session */
$this->twitterHost .= "statuses/update.xml?status=". urlencode(stripslashes(urldecode($stat)));

curl_setopt($this->ch, CURLOPT_URL, $this->twitterHost);

/* Execute and get the http code to see if it was succesfull or not*/
$result = curl_exec($this->ch);
$resultArray = curl_getinfo($this->ch);

if ($resultArray['http_code'] == 200) ;
return true;

return false;
}
}
?>

El proceso y formulario para los mensajes (tweets).

<?php
include_once('twitter.php');

$curTwitter = new twitter("usuario", "password");

if (isset($_POST['submit'])) {

$twitter_status = $_POST['twitter_stat'];

if (strlen($twitter_status) > 0) {

if( $curTwitter->setStatus($twitter_status) == true)
echo "<p>Updated Succesfully</p>";
else
echo "<p>Twitter is unavailable at this time</p>";
} else
echo "<p>Error: I won't send blank messages!</p>";
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Set your status on Twitter</title>
</head>
<body>
<h2>Set your status on Twitter</h2>

<p><strong>What are you doing?</strong></p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input name="twitter_stat" type="text" id="twitter_stat" size="40" maxlength="140" />
<input type="submit" name="submit" id="submit" value="Send"/>
</form>

</body>
</html>