Difference between revisions of "User:Opensource Obscure/http"

From Second Life Wiki
Jump to navigation Jump to search
(New page: With this script, a prim requests a new LSL Server public URL, then makes a http call that updates a db with the prim's public URL. <br>This is probably horrible, I can't code, don't use t...)
 
m (templatizationingsx)
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
With this script, a prim requests a new LSL Server public URL, then makes a http call that updates a db with the prim's public URL.
{{User:Opensource_Obscure/Backlink}}
<br>This is probably horrible, I can't code, don't use this if you don't know what you're doing.


<lsl>
* [[User:Opensource Obscure/http/gridurl-sample]] a sample script that shows how to use Gridurl to get persistent URLs while using LSL HTTP Server.
string a;
* [[User:Opensource_Obscure/Chromutate]] a web-based, dynamic installation that can be controlled from a web page. Uses Gridurl.
string b; // NOT NEEDED
key http_request_id;
string url = "http://....php?q="; // PHP PAGE TO MANAGE DB


default
Old projects (deprecated):
{
* [[User:Opensource_Obscure/http/snurl-sample]]
    state_entry()
* [[User:Opensource_Obscure/http/text-db]]
    {
        llRequestURL();   
    }
    http_request(key id, string method, string body)
    {
        if (method == URL_REQUEST_GRANTED)
        {
            a = body;
            llOwnerSay("MY URL: " + a);
            http_request_id = llHTTPRequest(url+a, [], "");           
        }
        else if (method == URL_REQUEST_DENIED)
        {
            llOwnerSay("Something went wrong, no url. " + body);
        }
        else if (method == "GET")
        {
            llHTTPResponse(id,200,"Hello World!");
            b = llGetHTTPHeader(id, "user-agent"); // NOT NEEDED
            llOwnerSay("USER AGENT: " + b);        // NOT NEEDED
        }
        else
        {
            llHTTPResponse(id,405,"Unsupported Method");
        }
    }
 
    touch_start(integer total_number)
    {
        llOwnerSay("MY URL: " + a);
        http_request_id = llHTTPRequest(url+a, [], "");         
    }
   
 
    http_response(key request_id, integer status, list metadata, string body)
    {
        if (request_id == http_request_id)
        {
            llInstantMessage(llGetOwner(), body);
        }
    }       
 
 
}
 
</lsl>

Latest revision as of 04:13, 22 April 2011

Go back to Opensource Obscure's userpage



Old projects (deprecated):