CODE
//
// To update twitter, say this into chat: tw message
//
// By Orlie Omegamu
// 8 June 2007
//
string user = "your_twitter_name";
string password = "your_twitter_password";
default
{
state_entry()
{
llListen(0, "", llGetOwner(), "");
}
listen(integer ch, string name, key id, string msg)
{
integer len = llStringLength(msg);
if (llGetSubString(msg, 0, 2)=="tw ")
{
integer end = len - 1;
msg = llGetSubString(msg, 3, end);
llWhisper(0, "Updating twitter.com with '"+msg+"'.");
llHTTPRequest("http://"+llEscapeURL(user)+":"+llEscapeURL(password)+"@twitter.com/statuses/update.xml", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded; charset=UTF-8"], "status="+llEscapeURL(msg));
}
}
http_response(key request_id, integer status, list meta, string body)
{
// Apparently, the data returned by twitter isn't recognized by LL, and so the body always contains a content type error even though the request succeeds.
// And the status code is 415 Unsupported media type
}
}