Difference between revisions of "Http request"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 11: Line 11:
|examples=<lsl>default
|examples=<lsl>default
{
{
     http_request(key request_id, string method, string body)
     state_entry()
     {
     {
         // Loop Back Request Data
         llRequestURL();
         llHTTPResponse(request_id, 200, body);
    }
    http_request(key id, string method, string body)
    {
         if (method == URL_REQUEST_GRANTED)
        {
            llSay(0,"URL: " + body);
        }
        else if (method == URL_REQUEST_DENIED)
        {
            llSay(0, "Something went wrong, no url. " + body);
        }
        else
        {
            llHTTPResponse(id, 200, body);
        }
     }
     }
}</lsl>
}</lsl>
|helpers
|helpers
|also_articles=
|also_articles
|also_events
|also_events
|also_functions=
|also_functions=
{{LSL DefineRow||[[llRequestURL]]|Request a new LSL Server public URL}}
{{LSL DefineRow||[[llRequestURL]]|Request a new LSL Server public URL}}
{{LSL DefineRow||[[llRequestSecureURL]]|Request a new LSL Server public URL}}
{{LSL DefineRow||[[llReleaseURL]]|Release a URL}}
{{LSL DefineRow||[[llHTTPResponse]]|For replying to HTTP requests}}
{{LSL DefineRow||[[llHTTPResponse]]|For replying to HTTP requests}}
{{LSL DefineRow||[[llGetHTTPHeader]]|Returns the requested HTTP header's value}}
{{LSL DefineRow||[[llGetHTTPHeader]]|Returns the requested HTTP header's value}}

Revision as of 18:38, 24 October 2008

  Note! Preview Documentation

This only exists on the preview grid

Description

Event: http_request( key request_id, string method, string body ){ ; }

Triggered when task receives an HTTP request.

• key request_id HTTP request id for response use.
• string method GET, POST, PUT
• string body Contents of the request.

Specification

See LSL_http_server for full specification.

Examples

<lsl>default {

   state_entry()
   {
       llRequestURL();
   }
   http_request(key id, string method, string body)
   {
       if (method == URL_REQUEST_GRANTED)
       {
           llSay(0,"URL: " + body);
       }
       else if (method == URL_REQUEST_DENIED)
       {
           llSay(0, "Something went wrong, no url. " + body);
       }
       else
       {
           llHTTPResponse(id, 200, body);
       }
   }

}</lsl>

See Also

Functions

•  llRequestURL Request a new LSL Server public URL
•  llRequestSecureURL Request a new LSL Server public URL
•  llReleaseURL Release a URL
•  llHTTPResponse For replying to HTTP requests
•  llGetHTTPHeader Returns the requested HTTP header's value
•  llEscapeURL
•  llUnescapeURL

Deep Notes

Signature

event void http_request( key request_id, string method, string body );