Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Landmark to sql database using lsl and php??

Everett Streeter
Registered User
Join date: 28 Apr 2007
Posts: 20
03-28-2008 18:57
First, thanks for all the help in advance. I am creating a vendor system - to learn, I know there are plenty out there - and I want each vendor to send its location, basically a landmark, to my database - I have been searching the wiki, but haven't had much luck. I tried llDetectedPos, and a few other things with no luck - any suggestions for basically recording where an object is and sending that to the sql database. I know how to send the information using php and sql, I have done it for many things, but need help with the landmark and LSL. Also, I was playing around with parcel name, parcel owner, parcel description, if I could send that too, that would be cool, but I couldn't get that to work. Here is the script I have with some information blocked out.

This script works, I just need to add the parts listed above.

default
{
state_entry()

{
llSetText( " ", < 1,1,1>, 1 );
}

touch_start(integer total_number)

{


string name;
string uuid;
string landmark;

name = llDetectedName(0);
uuid = llDetectedKey(0);
landmark = ???????;

key http_request_id;

http_request_id = llHTTPRequest( "http://www.blockedout.info/blockedout.php", [HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"], "name=" + name + "&uuid=" + uuid);
}

}
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
03-28-2008 19:37
You do not need to have the vendor send it's current location, Second Life does that for you by providing the appropriate headers in the request: http://wiki.secondlife.com/wiki/LlHTTPRequest

Specifically, it provides the X-SecondLife-Region and X-SecondLife-Local-Position headers.

Depending on your hosting provider and how the web server is configured, those headers might have to be accessed by another name. For instance, the way my setup is configured, I need to use code like the following to get the region info:

CODE
$simheader = $_SERVER['HTTP_X_SECONDLIFE_REGION'];


I think that there are numerous examples available, but I will see if I can dig up something more detailed.

.
_____________________
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
03-28-2008 19:41
See this page for more examples of both the LSL and corresponding PHP: http://rpgstats.com/wiki/index.php?title=ExamplellHTTPRequest

Keep in mind that you might have to make modifications depending on whether PHP is compiled as an apache module, like changing
CODE
$headers = apache_request_headers();
$region = $headers["X-SecondLife-Region"];
to this :
CODE
$region = $_SERVER['HTTP_X_SECONDLIFE_REGION'];
_____________________
Everett Streeter
Registered User
Join date: 28 Apr 2007
Posts: 20
Thanks
03-28-2008 20:23
Exactly what I am looking for!