Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: 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
Original Thread
06-10-2007 11:26
/15/57/189556/1.html
_____________________
i've got nothing. ;)
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
05-29-2008 16:23
any way to do this without having to use tw.... is it possible to twitter all local chat?


From: Orlie Omegamu
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
}
}
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
05-29-2008 22:38
I might have to look into Twitter now, and see if it's something useful to me. This tool looks like it could make usage of the twitter "platform" easy enough. Now to see how to actually USE the results.

Thanks for the cool script!
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
05-30-2008 12:35
nice little script. I was able to modify so that it twitters automatically some avatar info and location to be used for a travel bug game for slgeocaching.com

the big draw back is the fact that it does not work on sims that do not allow scripts. bummer.