
As documented in this blog entry, this is a way of broadcasting messages to Twitter. If you've your own shortcode. You don't? Oh.
<?
// This expects a call looking like thisscript.php?text=This+is+the+message
$text=trim($_REQUEST['text']);
if (strlen($text)>1) {
$text=trim(substr($text,8));
if (strlen($text)>120) { $text = substr($text,0,116)."... "; }
$text=$text." [Reply: 81xxx KEYWORD %2B msg]"; // Change how to reply
send_to_twitter($text,"twitter_username","twitter_password"); // Change your username/password!
}
function send_to_twitter($status,$username,$password) {
//this code based on http://www.morethanseven.net/posts/posting-to-twitter-using-php/
//
$url = 'http://twitter.com/statuses/update.xml';
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$status");
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
}
?>