Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Working twitter update script

Orlie Omegamu
Registered User
Join date: 12 Mar 2006
Posts: 16
06-08-2007 18:16
Yep, it even does authentication:
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
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
06-10-2007 11:26
/54/07/189899/1.html
_____________________
i've got nothing. ;)