I try 2 Weeks a simple XML-RPC request and it doesnt work. The Problem is, you cant find examples for help in Internet. What is false?
Can everybody help me? With an simple Example?
For example I had try this:
My Obejct in SL:
string EXPECTED_REQUEST_STRING_MESSAGE = "dennis";
string BAD_RESPONSE_STRING_MESSAGE = "I do not understand what you said";
string GOOD_RESPONSE_STRING_MESSAGE = "Hi.";
key myChannel;
default {
state_entry() {
llOwnerSay("Touch me to start listening for XML-RPC requests."
;}
touch_start(integer n) {
llOpenRemoteDataChannel();
llOwnerSay("Waiting for channel to open"
;}
remote_data(integer type, key channel, key uid, string from, integer integerValue, string stringValue) {
if (type == REMOTE_DATA_CHANNEL) {
myChannel = channel;
llOwnerSay("Channel Open. Channel Key="+(string)channel);
state waiting;
}
}
}
state waiting {
state_entry() {
llOwnerSay("Waiting for XML-RPC Requests..."
;}
remote_data(integer type, key channel, key uid, string from, integer integerValue, string stringValue) {
if (type == REMOTE_DATA_REQUEST) {
if (stringValue == EXPECTED_REQUEST_STRING_MESSAGE) {
// uid is the identifier for the request message.
llRemoteDataReply(channel, uid, GOOD_RESPONSE_STRING_MESSAGE, 1);
llOwnerSay("hat geklappt!"
;} else {
llRemoteDataReply(channel, uid, BAD_RESPONSE_STRING_MESSAGE, 0);
}
} else {
// Code would go here to respond to a new open channel, etc...
// Check the options for 'type' in the LSL Wiki.
}
}
touch_start(integer n) {
state default;
}
state_exit() {
llCloseRemoteDataChannel(myChannel);
llOwnerSay("Channel closed. Touch again to start listening on channel."
;}
}
And PHP:
<?
include('IXR_Library.inc.php');
$ll_packet = [
'Channel' => '0498b49d-a1aa-b12a-73ca-dbda7f82beaf',
'IntValue' => 32,
'StringValue' => 'dennis'];
// Create the client object
$client = new IXR_Client('http://xmlrpc.secondlife.com/cgi-bin/xmlrpc.cgi');
// Run a query for PHP
if (!$client->query('llRemoteData', $ll_packet)) {
die('Something went wrong - '.$client->getErrorCode().' : '.$client->getErrorMessage());
}
// Display the result
echo '<pre>';
print_r($client->getResponse());
echo '</pre>';
?>
