Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Passing Parameters to PHP

Tarquin Quasimodo
Registered User
Join date: 8 Nov 2005
Posts: 38
07-05-2006 15:06
How do you POST parameters?

At the moment I use
llHTTPRequest("http://www.mywebsite.com?sim="Ambleside";),[HTTP_METHOD,"GET"],"";)

and in my PHP script I use $_GET['sim'] to find the passed parameter.


The Wiki suggests that parameters can be read using $_POST, which sounds easier to use, but I cannot see how I would pass the parameters?

How do I set

sim=Ambleside
user="Tarquin Quasimodo"
amount=410

and pick them up in my PHP script with

$_POST['sim']
$_POST['user']
$_POST['amount']
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
07-05-2006 18:38
since im a php noobie i cant really lay out a good explination but

http://us3.php.net/manual/en/language.variables.external.php

ack my bad your asking about the lsl side arnt you
Tarquin Quasimodo
Registered User
Join date: 8 Nov 2005
Posts: 38
07-05-2006 19:26
From: Osgeld Barmy
ack my bad your asking about the lsl side arnt you


Yes, I am talking about my SL object. LOL

I want to save building my string:-

http://www.mywebsite.com?sim=Ambleside&user=Tarquin%20Quasimodo&amount=410

and do my Http call with the more secure POST method. (The user could see the the values I am passing)
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
07-05-2006 21:09
From: Tarquin Quasimodo
How do you POST parameters?

At the moment I use
llHTTPRequest("http://www.mywebsite.com?sim="Ambleside";),[HTTP_METHOD,"GET"],"";)

and in my PHP script I use $_GET['sim'] to find the passed parameter.


The Wiki suggests that parameters can be read using $_POST, which sounds easier to use, but I cannot see how I would pass the parameters?

How do I set

sim=Ambleside
user="Tarquin Quasimodo"
amount=410

and pick them up in my PHP script with

$_POST['sim']
$_POST['user']
$_POST['amount']



llHTTPRequest("http://www.mywebsite.com/phpscript.php";),[HTTP_METHOD,"POST"],"sim=Ambleside&user=Tarquin%20Quasimodo&amount=410";);

remember to llUrlEncode() the values before building your post body.
_____________________
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
07-05-2006 21:12
Note: POST isn't necessarily more secure from second life since they have no address bar to see the url (hence the user won't ever really see your GET values.), but you will see it in server logs. POSTs are still plain text though so if they are intercepted it's trivial to get the info out of 'em. Only real advantage to POST if you are using your own servers (and no one else has access to the logs) from second life is that urls have a maximum amount of data that can be sent (this depends on the web server iirc). POSTS have no max that I'm aware of.
_____________________
Kalel Venkman
Citizen
Join date: 10 Mar 2006
Posts: 587
07-06-2006 08:31
Oh, so that's what the main difference is!

CGI looks easy to work with if you do it all the time, but I do it once in a blue moon, so I have to relearn it every time I need to use it. :(