RPC FOR THE COMMON.... errr... GEEK! //----- This is an html file in some folder on a website. I named mine "hello_world.html". You should do the same. //----- Can be viewed at http://slredux.com/xml-rpc/hello_world.html
Channel:
Number:
String:
//----- this is the LSL code you need to put in an object somewhere in the world key xmlrpcchan; key requestid; default { state_entry() { llOpenRemoteDataChannel(); } remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) { llOwnerSay("TRIGGER"); if (type == REMOTE_DATA_CHANNEL) { llOwnerSay((string)channel); xmlrpcchan = channel; llSetText((string)xmlrpcchan, <1, 1, 1>, 1); } else { llSay(0, "Integer recieved: " + (string)ival); llSay(0, "String recieved: " + sval); } } touch_start(integer num) { llSay(0, "MY xml chan is " + (string)xmlrpcchan); } } //----- And this here is the BEAST known as RPC. This can go in hello_world.php or whatever you specified in the html file //the "sendRequest" function is the core of the system. '; $data .= ''; $data .= 'llRemoteData'; $data .= ''; $data .= 'Channel'.$channel.''; $data .= 'IntValue'.$int.''; $data .= 'StringValue'.$string.''; $data .= ''; $fp = fsockopen("xmlrpc.secondlife.com", 80); fputs($fp, "POST /cgi-bin/xmlrpc.cgi HTTP/1.1\r\n"); fputs($fp, "Host: xmlrpc.secondlife.com\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ". strlen($data) ."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $data); fclose($fp); return; } $p_data = implode('', file('php://input')); $p_data = explode('&', $p_data); foreach ($p_data as $p_val) { $d_parts = explode('=', $p_val); $_POST[$d_parts[0]] = urldecode($d_parts[1]); } $channel = $_POST["chan"]; $integer = $_POST["int"]; $string = $_POST["string"]; echo "Sending $string and $integer to $channel"; if ($channel != "") { sendRequest($channel, $integer, $string); } ?>