Jump to content
Rhiannon Arkin

how to get object http url?

Recommended Posts

Hi

One rhia-question: I'm exploring this whole http command structure. 

Here's where I am stuck. How do I know the url for the object in world I want to send stuff to ? The object already sent info to the off world server, but now this off world server wants to send things back to that same object. I know i have the key of the object through the headers. but how do i get the http/.... address so the php can send things? And, is that object always 'listening' to such pings ? 

thanks for any insight

R.

 

Share this post


Link to post
Share on other sites

Take a look at the protocol for llRequestURL in the LSL wiki. Objects in SL do not have URLs unless they contain scripts that have requested them, and such URLs are ephemeral.  You can send the information from your in-world object to the external site so that it knows where to direct a reply, but you can't count on that in-world URL being permanent.  In particular, notice in the wiki that

When a region is (re)started all HTTP server URLs are automatically released and invalidated.

so you need to detect a restart and send an updated URL to your external object or, better, send periodic updates just in case.

  • Like 1

Share this post


Link to post
Share on other sites

ok thanks for the info. That makes it a lot more complex. Couldn't they just send the url with the header ? 

Seems all initiative needs to start at the object in world. the server can't just start doing things. (maybe a good thing. )

interesting

 

R.

 

 

Share this post


Link to post
Share on other sites

I send the url in the get request ...?

here is a snippet where i send the url & info to a google form,

which is linked to a google spreadsheet.

 http_request(key id, string method, string body)
    {   integer responseStatus = 400;
        string responseBody = "Unsupported method"; 
        if (method == URL_REQUEST_DENIED)
            throw_exception("The following error occurred while attempting to get a free URL for this device:\n \n" + body);
        else if (method == URL_REQUEST_GRANTED)
        {  url = body;
          llLoadURL(llGetOwner(), "Click to visit my URL!", url); 
         string send = "https://docs.google.com/forms/d/e/1FAIpQLSfmFFNdHlOpvkXBU_AyPKj4ATjTJdS8iA2N3K2ervPNxNwE_A/formResponse?entry.1012667783=" 
         + region + "&entry.457815027=" + url + "&submit=Submit"; 
          
          llHTTPRequest(send,
        [HTTP_METHOD, "POST",
        HTTP_VERBOSE_THROTTLE, FALSE,
        HTTP_BODY_MAXLENGTH, 16384],
        "");
        llOwnerSay("sent...");
           
        }
        else if (method == "GET")
        {   avi = llGetRegionAgentCount();
            responseStatus = 200;
            responseBody = 
              "REGION NAME : " + region +              
              "\nTIME DIALATION : " + (string)llGetRegionTimeDilation() +
              "\nREGION FPS : " + (string)llGetRegionFPS() +
              "\nAVATARS : " + (string)  avi  ;
        }
        llHTTPResponse(id, responseStatus, responseBody);
    } 

 

  • Like 1

Share this post


Link to post
Share on other sites

thanks it's getting a bit clearer and clearer. 

I understand the first part where it sends the string 'send' to the google form. that makes sense. 

for the 'get' part, well, i have to understand how this works a bit more. Seems like one of these sl scripting things that seems very strange and then suddenly, after deep studies and experiments, start to make sense. 

thanks

R.

 

 

Share this post


Link to post
Share on other sites

else if (method == URL_REQUEST_GRANTED) the prim got a url, ... so i post it to the web...

else if (method == "GET") .... something is polling this prim for it's info... so i send it! ( in a diff part of the script)

 

hope this helps :)

Edited by Xiija
  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, Xiija said:

I send the url in the get request ...?

here is a snippet where i send the url & info to a google form,

which is linked to a google spreadsheet.


 http_request(key id, string method, string body)
    {   integer responseStatus = 400;
        string responseBody = "Unsupported method"; 
        if (method == URL_REQUEST_DENIED)
            throw_exception("The following error occurred while attempting to get a free URL for this device:\n \n" + body);
        else if (method == URL_REQUEST_GRANTED)
        {  url = body;
          llLoadURL(llGetOwner(), "Click to visit my URL!", url); 
         string send = "https://docs.google.com/forms/d/e/1FAIpQLSfmFFNdHlOpvkXBU_AyPKj4ATjTJdS8iA2N3K2ervPNxNwE_A/formResponse?entry.1012667783=" 
         + region + "&entry.457815027=" + url + "&submit=Submit"; 
          
          llHTTPRequest(send,
        [HTTP_METHOD, "POST",
        HTTP_VERBOSE_THROTTLE, FALSE,
        HTTP_BODY_MAXLENGTH, 16384],
        "");
        llOwnerSay("sent...");
           
        }
        else if (method == "GET")
        {   avi = llGetRegionAgentCount();
            responseStatus = 200;
            responseBody = 
              "REGION NAME : " + region +              
              "\nTIME DIALATION : " + (string)llGetRegionTimeDilation() +
              "\nREGION FPS : " + (string)llGetRegionFPS() +
              "\nAVATARS : " + (string)  avi  ;
        }
        llHTTPResponse(id, responseStatus, responseBody);
    } 

 

any idea where I can obtain such?  as I have an idea and this idea would be useful to use google, as my own server is a spaz.

Share this post


Link to post
Share on other sites

Basically you create a google form, and then link it to a google sheet... so all the

form entries go to the sheet. Your http post fills the form and sends it, and you query the sheet

 when you need info.  You can use right click / view page source  - on the form to get the entry id#'s.

I googled and used youtube to find out how to do it all :)

also... if you need a FREE host for web pages for anything, you can use Github Pages...

https://pages.github.com/

( I used that to test a code page I am building.... https://xiija.github.io/index.html  )

 

Edited by Xiija
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...