I'm trying to get my feet wet with LSL and PHP and something really strange happens: My object says "200 error" on chat channel 0 altho it only uses llOwnerSay().
I googled the web and the forums to find an explanation but I found nothing.
Here is my little LSL script:
-------------------------------
string host = "http://my.host.com/myfile.php";
key req_id;
default
{
touch_start(integer total_number)
{
string query = "?name=" + llEscapeURL(llDetectedName(0))
+ "&key=" + (string)llDetectedKey(0);
req_id = llHTTPRequest(host + query, [], ""
;}
http_response(key request_id, integer status, list metadata, string body)
{
if (req_id == request_id)
{
llOwnerSay("Status: " + (string)status);
integer i = llSubStringIndex(body, "<DATA>"
;integer j = llSubStringIndex(body, "</DATA>"
;// Delimiters because the free webhost adds unwanted stuff
if ( (i != -1) & (j != -1) )
{
body = llGetSubString(body, i + 6, j - 1);
llOwnerSay(body);
}
else
{
llOwnerSay("*** ERROR ***"
;llOwnerSay(body);
}
}
}
}
-------------------------------
All it does is to send the key and the name of the AV touching the object to the server which sends them back.
And here is the tiny PHP script:
-------------------------------
<?php
$name = urldecode($_GET['name']);
$key = $_GET['key'];
$return = "<DATA>Key: ".$key." | Name: ".$name." touched me.</DATA>\n";
echo $return;
?>
-------------------------------
Result:
-------------------------------
(Plain chat)
[14:48] Object: 200 error
(Owner only)
[14:48] Object: Status: 200
[14:48] Object: Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx | Name: Kaluura Boa touched me.
-------------------------------
Where does this extraneous chat line comes from? Is there a way to prevent it? Who's fault is it?
Any hint/idea/suggestion?