The script below, ideally, is supposed to (on_rez) communicate with an offline database (via a URL) and insert the card owner into the database as a new record.
I've tested the PHP page itself using the variables that this script is supposed to pass, and it actually works fine (I've replaced the URL and the password variables in the script below, but they are correct in my script in-world). But this script, when I put it into an object, does... nothing. It spits out the two llSays (registering and the cardholder uuid) and that's it. I get nothing from the URL or anything. No error messages, no SQL syntax problems, nothing at all from the URL.
Even if I replace this line:
CODE
llHTTPRequest(url+"?uuid=
"+llEscapeURL(cardHolder)+
"&points="+llEscapeURL(points)+
"&action="+llEscapeURL(action)+
"&password="+llEscapeURL(secret),
[HTTP_METHOD, "GET", HTTP_MIMETYPE, "application/x-www-form-urlencoded"],"");
with this one (with legitimate values of course - line breaks are added to make this easier to read on the forums):
CODE
llHTTPRequest("http://www.example.com/example/example.php?password=stuff
&uuid=stuff
&action=stuff",
[HTTP_METHOD, "GET", HTTP_MIMETYPE, "application/x-www-form-urlencoded"],"");I still get absolutely nothing!
It's really frustrating, and I honestly now have no idea what I could be doing wrong. The script is no where near finished, there's several things I still need to do with it, but my first hurdle (getting the script to talk to the database) is the one I can't seem to tackle now.Any ideas? Any help appreciated.
Thanks!
- R
CODE
string points = "0"; //default # of points to add to card
// key holders and variables
key cardHolder;
key registerCard;
string action;
// database stuffs
string secret = "example"; //password for server requests
string url = "http://www.example.com/example/example.php";
default
{
state_entry()
{
llSay(0,"Registering your card...");
string action = "register";
key cardHolder = llGetOwnerKey(llGetOwner());
registerCard = llHTTPRequest(url+
"?uuid="+llEscapeURL(cardHolder)+
"&points="+llEscapeURL(points)+
"&action="+llEscapeURL(action)+
"&password="+llEscapeURL(secret),
[HTTP_METHOD, "GET", HTTP_MIMETYPE, "application/x-www-form-urlencoded"],"");
llSay(0,cardHolder);
}
// reset script onRez
on_rez(integer start_param){
llResetScript();
}
// http response information handlers
http_response(key id, integer status, list metadata, string body)
{
if(id == registerCard){
// if registration is successful
if(body == "registered"){
llSay(0,"Successful.");
llRemoveInventory(llGetScriptName());
}
// already own a card
if(body == "existing"){
llSay(0,"Existing.");
}
if(status != 200){
body = "ERROR: Cannot connect to server.";
}
if(status = 499){
body = "ERROR: Request timeout.";
}
}
}
}

