Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Communicating with an External Database

Edison Swain
Registered User
Join date: 7 Dec 2006
Posts: 51
12-22-2006 17:47
Hi all,

New to scripting - I am basically hoping that someone can tell me if I am understanding this correctly.

I want to be able to send some information back and forth from an object in Second Life to an external database. By the looks of all the info I've read about LSL, I am basically going to need to build a layer of PHP in between to process things.

The object in SL will use the llHTTPRequest function to pass a list of parameter name/parameter value pairs to the PHP script.

The PHP script will then do what it needs to do to pass this information to the database.

The database will do it's job, and return information back to the PHP script

The PHP script can only output a string of characters back to the object in SL. So I'd need to encode the data I want to send in such a way that it can be sent as a string, and then parsed out by the object in SL.

From there I will be able to have the object in SL process that string, for example, parsing back out to determine a new set of parameter name/parameter value pairs that the database needed to pass.

So basically, LSL can talk to PHP only using stings (ie, send data out by encoding in the URL, and receive data back as a single string which is the output of the PHP script) And the PHP script talks to the database using all it's normal PHP functions.

Is this all correct? Am I understanding it properly? Is this the right way, and/or the best way to deal with an external database?

Thanks in advance for any responses!!! :)
Geuis Dassin
Filming Path creator
Join date: 3 May 2006
Posts: 565
12-22-2006 17:55
Yeah, you pretty much hit the nail on the head.

http://lslwiki.com/lslwiki/wakka.php?wakka=llHTTPRequest

Biggest things to worry about is the packet limit: ie you can at most transmit 2k of information per request, 2048 bytes. Also, you are throttled to 100 requests per 100 seconds.

I provide very inexpensive hosting, w/ php5 and mysql, if you need it.
Edison Swain
Registered User
Join date: 7 Dec 2006
Posts: 51
12-22-2006 18:24
From: Geuis Dassin
Yeah, you pretty much hit the nail on the head.

http://lslwiki.com/lslwiki/wakka.php?wakka=llHTTPRequest

Biggest things to worry about is the packet limit: ie you can at most transmit 2k of information per request, 2048 bytes. Also, you are throttled to 100 requests per 100 seconds.

I provide very inexpensive hosting, w/ php5 and mysql, if you need it.



Thanks for the reassurance.

I actually just got my first LSL script to work - I figured out how to talk to a PHP script and have it send some info back. So now it's just getting the PHP to talk to MySQL (which I've never done before, but have many books on!) So it looks like I'm getting a grasp on it.

And thanks for the offer of hosting, but I actually already have hosting for the real world business I run and it has MySQL and PHP preloaded already. Tacking any Second Life projects onto the back side of that will be easy enough.

Thanks again for the help!