Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with llHTTPRequest

Abdullah Lemon
Lemons Estates
Join date: 2 Oct 2008
Posts: 56
11-26-2008 02:47
Good day SLers.. me again.. new question...

i've been trying to work this llHTTPRequest out.. but no luck :(

i want to send transaction data from an object in SL to my website that runs PHP and MySql.. and save the data in the database..

this is my code

From: someone

string str_url = "http://www.website.com/test.php?";

llHTTPRequest(str_url+"aviName="+name+"&objName="+body+"&objKey="+id+"&regName=test",[HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"],body);


can you guys help me with it?

thank you..
Damanios Thetan
looking in
Join date: 6 Mar 2004
Posts: 992
11-26-2008 03:38
What is the exact question?
_____________________
Abdullah Lemon
Lemons Estates
Join date: 2 Oct 2008
Posts: 56
11-26-2008 03:44
i want a code that help me send these values to MySql database thru post method

it's like clicking on this link

From: someone
http://website.com/trans.php?aviName=Abdullah Lemon&objName=crate&objKey=123456-13235-133&regName=TheApusRegion


so.. by using this PHP code

From: someone

$avName = $_GET['aviName'];
$obName = $_GET['objName'];
$avKey = $_GET['objKey'];
$reName = $_GET['regName'];
$ADD_DATA = mysql_query("INSERT INTO transTEST (aviName, objName, objKey, regName) VALUES('$avName', '$obName', '$avKey', '$reName' ) ";) or die(mysql_error());


i can save the data in my database..

thank you
Damanios Thetan
looking in
Join date: 6 Mar 2004
Posts: 992
11-26-2008 03:53
Use a 'GET' not a 'POST'.
_____________________
Abdullah Lemon
Lemons Estates
Join date: 2 Oct 2008
Posts: 56
11-26-2008 04:12
ok... would you please give me the code?

coz i have tried this

From: someone
string str_url = "http://www.website.com/test.php?";

llHTTPRequest(str_url+"aviName="+name+"&objName="+body+"&objKey="+id+"&regName=test",[HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"],body);


and it didnt work....


thank you
Jeredin Denimore
Romani Ite Domum
Join date: 5 Jul 2008
Posts: 95
11-26-2008 05:52
From: Damanios Thetan
Use a 'GET' not a 'POST'.


That ^^^

Change POST in your code line to read GET.
Jeredin Denimore
Romani Ite Domum
Join date: 5 Jul 2008
Posts: 95
11-26-2008 05:56
You also didn't post any code related to ensuring that the variables being passed to llHTTPRequest in the URL concatenation do not break the URL format or invalidate the URL in some way. If changing POST to GET does not fix it, check there as well.
Wouter Hobble
Registered User
Join date: 25 Mar 2008
Posts: 21
11-26-2008 08:29
HEre is your fix:

string str_url = "http://www.website.com/test.php?";

llHTTPRequest(str_url+"aviName="+llEscapeURL(name)+"&objName="+llEscapeURL(body)+"&objKey="+(string)id+"&regName=test",[],"";);
Abdullah Lemon
Lemons Estates
Join date: 2 Oct 2008
Posts: 56
11-26-2008 12:43
From: Wouter Hobble
HEre is your fix:

string str_url = "http://www.website.com/test.php?";

llHTTPRequest(str_url+"aviName="+llEscapeURL(name)+"&objName="+llEscapeURL(body)+"&objKey="+(string)id+"&regName=test",[],"";);


OMG. thx so much.. that worked like charm.. wohooo..

thx you guys :)