Jump to content
Sign in to follow this  
Shihan Feiri

llOpenRemoteDataChannel

Recommended Posts

I have recently written a long post in this forum about mysql-php-lsl communication with very concrete examples. Have a look at this discussion: http://community.secondlife.com/t5/LSL-Scripting/The-Impossible/td-p/2884582 and specifically at message 10 of eleven in this post.

As far as I know these are the only concrete examples available that use the updated PHP5 mysqli functions for the http_server LSL functions with "http-get". The method "http-get" requires less PHP scripting skills and is therefore easier to work with than the method "post".

Share this post


Link to post
Share on other sites

Thank you Estelle, but this is simple collecting data from database. I try to find working sample  wher you from web page manage inworld object.

For now, I'm still in dark with so manny "solution".

If someone have time to teach me this part inworld, I am open to arange this class.

Share this post


Link to post
Share on other sites

when we are on this theme, what is best way to use llReleaseURL ? Befor of creating new one? How I understund, each reset of script creat new one. And whats happen if too much llRequestURL are maded? Are they reset with region restart?

Share this post


Link to post
Share on other sites

Edit: Script changed to contain link to this discussion. The body only shows the beginning of the header of the website, not the actual content of the website. So llRequestUrl seems to be indeed the better method.

I have never tested this but use one of the LSL scripts that I have in my examples. Change the link of the outgoing http-request the website that you want to read from.

Then in the the http-response event, read the body of the website.

Something like this:

 

key requestKey;



default
{
state_entry()
{
llSetText("Click to read website.",
<1.0,1.0,1.0>, 1.0);

}

on_rez(integer startParam)
{
llResetScript();
}

changed(integer change)
{
if (change & (CHANGED_OWNER))
llResetScript();
}


touch_end(integer int)
{

llSetText("Reading website", <1.0,0.0,0.0>, 1.0);

// start communication with database
string body = "";

//llEscapeURL is not really necessary but I have the habit to use it with all data I send to an URL
string URL = "http://community.secondlife.com/t5/LSL-Scripting/llOpenRemoteDataChannel/m-p/2887018/highlight/false#M26796";

//define a list to contain the parameters of the http request.
list parameters = [HTTP_METHOD, "GET"];

//send the request
requestKey = llHTTPRequest(URL, parameters, body);

//Use this for debugging:
//llOwnerSay(URL);

}

// Catching reply from webserver
http_response(key request_id, integer status, list metadata, string body)
{
if (request_id == requestKey)
llOwnerSay(body);



llSetText("Click to read website.",
<1.0,1.0,1.0>, 1.0);

}

}

 

Play with it, see what you get. Change the method to "post" [mainly a different parameter list) and see what you get.

Share this post


Link to post
Share on other sites

Most of the answers to your questions are in the link of your message:

"When a region is (re)started all HTTP server URLs are automatically released and invalidated"

"Removing the prim/script will release all URLs previous assigned."

From these statements I would deduct that all URLs are removed from the sim with a reset of the script. If this assumption is true, then the example on the page of llReleaseUrl does indeed not make sense.

llReleaseUrl seems to make only sense if you need several URLs for your script but you need only one of these URLs for a process. Then you call for each process the specific URL and release all others.

That is the only scenario, how llReleaseUrl would make sense to me.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...