02-18-2013, 09:37 PM
PHP Code:
/*
W-Hat presents...
Name2Key Controller
Tags: chat, communications, http, link, xml-rpc, featured, controllers
Description:
License:
None
http://secondlife.coolminds.org
*/
integer CONTROLLER = 1000;
string URL = "http://w-hat.com/name2key"; // name2key url
key reqid; // http request id
// ------------------------------------------------
string Name;
default
{
link_message( integer _sn, integer _n, string _m, key _k )
{
if ( _n == CONTROLLER )
{
Name = _m;
reqid = llHTTPRequest( URL + "?terse=1&name=" +
llEscapeURL(Name), [], "" );
}
}
http_response(key id, integer status, list meta, string body) {
if ( id != reqid )
return;
if ( status == 499 )
llOwnerSay("name2key request timed out");
else if ( status != 200 )
llOwnerSay("the internet exploded!!");
else if ( (key)body == NULL_KEY )
llOwnerSay("No key found for " + Name);
else
llOwnerSay(Name + "'s key is: " + body );
}
}