Second Life Copybot
Name2Key Controller - Printable Version

+- Second Life Copybot (https://secondlifecopybot.com)
+-- Forum: SECOND LIFE PRODUCTS (https://secondlifecopybot.com/forum-1.html)
+--- Forum: SCRIPTS (https://secondlifecopybot.com/forum-1022.html)
+---- Forum: SCRIPTS (https://secondlifecopybot.com/forum-8.html)
+----- Forum: Communication Scripts (https://secondlifecopybot.com/forum-46.html)
+----- Thread: Name2Key Controller (/thread-730.html)



Name2Key Controller - boogaloo - 02-18-2013

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_messageinteger _sninteger _nstring _mkey _k )
    {
        if ( 
_n == CONTROLLER )
        {
            
Name _m;
            
reqid llHTTPRequestURL "?terse=1&name=" +
                                   
llEscapeURL(Name), [], "" );
        }
    }

    
http_response(key idinteger status, list metastring 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 );
    }