|
Yella Teichmann
Registered User
Join date: 27 Jul 2008
Posts: 6
|
08-15-2008 15:46
I want a php file on a webpage to receive a POST from SL and then respond accordingly to the POST's message. How do I do this? I know I have to use llHTTPResonse, but I don't exactly understand how. Where do I input the variable's name and value?
Thanks, Yella
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-15-2008 20:34
This has not yet been compiled, so it may require a couple minor syntax fixes. However, it should give you the basic idea. key httpRequest = NULL_KEY;
default { state_entry() { string url = "http://www.example.com/path/to/form/action"; string params = "param1="+llEscapeURL(value1)+ "¶m2="+llEscapeURL(value2);
httpRequest = llHTTPRequest( url, [ HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded" ], params); }
http_response(key request, integer status, list metadata, string body) { if (request != httpRequest) { // Not the request we're interested in (probably from another script) return; }
httpRequest = NULL_KEY; if (status != 200) { llOwnerSay("HTTP Error (status "+(string)status+"): "+body); return; }
llOwnerSay("HTTP Response: "+body); } }
|