All pastes #1336715 Raw Edit

Anonymous

public text v1 · immutable
#1336715 ·published 2009-02-14 03:46 UTC
rendered paste body
string a;
string b;
key http_request_id;
string url = ".............php?q=";

default
{
    state_entry()
    {
        llRequestURL();     
    }
 
    http_request(key id, string method, string body)
    {
        if (method == URL_REQUEST_GRANTED)
        {
            a = body;
            llOwnerSay("MY 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");
            llOwnerSay("user agent: " + b);
        }
        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)
        {
            llOwnerSay(body);
        }
    }        


}