Name2Key CGI Wrapper

From libsecondlife

Jump to: navigation, search

This simple perl cgi script uses the name2key program from libsl to do lookups from a website

 
#!/usr/bin/perl -w
use FileHandle;
use IPC::Open2;
use CGI ':standard';
 
$q = new CGI;
 
# Example: http://www.webserver.com/cgi-bin/name2key.cgi?first=Silly&last=Sally
# Output: UUID: 5c589404b8404b62aa2cf50ec7ded332
 
## set these to your local configuration
$name2key = "/home/jradford/libsl/bin/name2key.exe";
# for windows just set the following to blank
$mono = "/usr/local/mono-1.2.4/bin/mono";
$bot_login_first="botfirstname";
$bot_login_last="botlastname";
$bot_login_pass="botloginpassword";
## End User Variables
 
 
print $q->header;
 
@args = ($mono, $name2key, $bot_login_first, $bot_login_last, $bot_login_pass, $q->param('first'), $q->param('last'));
 
$pid = open2(*Reader, *Writer, @args);
print Writer "\r\n";
 
while(<Reader>)
{
        next unless (/^UUID.*/);
print "$_<BR>\n";
}