|
Coburn Constantine
Registered User
Join date: 16 Jul 2008
Posts: 6
|
09-02-2008 04:53
Hey all, I've been reading up on the database posts and have been able to create a database which is accessible from Second Life using a PHP file.
But i have this question: Say in SL, my character name is 'Alex ABC', how do i send this name in Second Life to the PHP script so that when i query the database. I know that there is a function in which it can detect the name of a character that touches an object but i have no idea how to send it through the PHP scripts.
Any tips on how to guide me on this?
Thanks
|
|
Georg Stonewall
Husband of Nikki
Join date: 21 Jan 2007
Posts: 211
|
09-02-2008 05:04
Have a look at this wiki page, its a good start http://wiki.secondlife.com/wiki/LlHTTPRequest
_____________________
G&N Quality Design SLURL  Blog  Flickr  XStreetSL 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
09-02-2008 08:07
A URL is composed of several parts. The query part of a URL is everything after the first question mark (?), and it is composed of parameter names and values like "param1=value1¶m2=value2&..." (actually there are now more "correct" and "preferred" ways of separating the parameters than the ampersand, but it's still the most commonly used syntax). You'll want to escape each value (as in 'value1', 'value2', etc. above) with llEscapeURL() so that certain special characters (like '&' which delimits another paramter assignment) don't mess with the parsing. You could do the same with the parameter names, but it is usually easier to just give them simple names with only safe characters like a-z, A-Z, 0-9, _ and -.
If you are using the POST method (with the 'application/x-www-form-urlencoded' MIME type), you can also put such variable assignments in the body of the request (the last parameter in llHTTPRequest()) instead of after a question mark in the URL. You can also include a lot more data in this manner. I've actually had problems using both the URL-encoded parameters and parameters in the body when using the POST method (not sure if that was SL or the receiving end, but it is SUPPOSED to be okay), so it might be safer to JUST use the request body when you POST. Note that llEscapeURL() has a character limit, so you might need to break up large values into chunks, encode them, then stick them together again.
|