Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

External Database scripting examples?

WickedTribe Woodget
Registered User
Join date: 12 Apr 2007
Posts: 15
06-13-2007 04:15
Can you please point me to examples of code/scripts to store information on a webserver?

I want a script that writes information to my ASP>NET webserver and can read information back from it.

I have looked for examples of llHTTPRequest() but can't find usable examples of code to do this.

Thanks.
Cherry Hainsworth
Registered User
Join date: 31 Jul 2006
Posts: 125
06-13-2007 04:46
Hi, WT

Did you find this?
http://rpgstats.com/wiki/index.php?title=XMLRPC
and this:
http://rpgstats.com/wiki/index.php?title=LlOpenRemoteDataChannel

I haven't tried it yet, but the documentation has certainly improved over the last couple of months.

Regards,
Cherry
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
06-14-2007 01:05
The basic communications I'm using in a similar project are at
http://rpgstats.com/wiki/index.php?title=LlHTTPRequest
I'm using some PHP programming on the website for local processing and interfacing that to a MySQL data base and also alocal .htm page to view and work on the data base OFF_SL.

This is helpfull if you are an experienced beginner like myself.
http://www.w3schools.com/php/default.asp
Check you website host to see if they support MySQL data base and they will usually have sample set-up scripts. If hosting yourself, you will need to install MySQL - it is free.
WickedTribe Woodget
Registered User
Join date: 12 Apr 2007
Posts: 15
06-14-2007 10:01
Thanks, will check out these...
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
06-14-2007 10:39
You might also what to take a look at the code here http://w-hat.com/httpdb
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
06-14-2007 11:12
What part do you need help with?
1. Communication from LSL to the Web Server?
2. Retrieving values from the LSL request on the Web Server?
3. Communicating to the Database from .NET?
4. Sending a response from the Web Server to LSL?
5. Dealing with that response in LSL?

6. All of the above?
WickedTribe Woodget
Registered User
Join date: 12 Apr 2007
Posts: 15
06-14-2007 14:10
All of the above, hehe.

I want to store avatar keys and object names offworld and retrieve this information via the use of LSL scripts.

I have a web server currently running Windows Server 2003, with ASP.NET and SQL Server, MySQL and MS ACCESS database systems.

Ideally I would like a simple code snippet for:

1. LSL script to write information to the db
2. LSL script to read information from the db

and then details on how to set up things on the webserver...

Currently the functions and examples I look at assume more familiarity than I have. I am fairly competent with LSL but not as much with webserver stuff and db. Any help appreciated.

Thanks
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
06-14-2007 15:01
If I get a chance tonight I'll try to write something up.

But this is what you need to do basically:
1. Create an Access Database to with appropriate tables to hold your data. (This can be upgrade to SQL later if you feel the need, but I also found Access to work fine for anything under 30ish users at a time, and probably even higher than that.)

2. Create an ASP script which will process the data that you send to it. I would suggest sending the data via the POST method, as it includes the data in a separate packet from your HTTP request, which means it can hold more data.

More Info here:
http://www.cs.tut.fi/~jkorpela/forms/methods.html

You will be processing this data exactly the same as if it were being submitted to your script from an HTML form with Input fields.

You could make this 'processor' with ASP.NET if you chose (or PHP, Coldfusion or any other CGI type processor), but I'm more familiar with ASP 2.0 than .NET, and have lots of example code I can work from.

3. Create your LSL Script which will call llHTTPRequest, the data you want to send should be formatted in the body parameter as name=value pairs. Some type of separator character may be needed between variables, though I can't recall what it is right now.

4. Handle the http_response event in your LSL script to know how the ASP Script responded

I'll try to get more informaiton posted later if you need.
Misterblue Waves
Registered User
Join date: 26 Jun 2005
Posts: 8
Some examples in the script wiki
06-14-2007 22:38
Also check out the entry at
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llHTTPRequest

This also has a pointer to some example code (LSL and PHP) at
http://www.lslwiki.net/lslwiki/wakka.php?wakka=ExamplellHTTPRequest

There was also an example by Zero Linden which uses the filesystem to store data. It is called 'silo' but I can't seem to find the URL at the moment
WickedTribe Woodget
Registered User
Join date: 12 Apr 2007
Posts: 15
06-17-2007 07:28
I am familiar with Access, so that would be an easy db to use. sample code would be fantastic!