Rhiannon Arkin Posted April 14, 2018 Share Posted April 14, 2018 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. Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 14, 2018 Share Posted April 14, 2018 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. 1 Link to comment Share on other sites More sharing options...
Rhiannon Arkin Posted April 14, 2018 Author Share Posted April 14, 2018 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. Link to comment Share on other sites More sharing options...
Xiija Posted April 15, 2018 Share Posted April 15, 2018 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); } 1 Link to comment Share on other sites More sharing options...
Rhiannon Arkin Posted April 15, 2018 Author Share Posted April 15, 2018 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. Link to comment Share on other sites More sharing options...
Xiija Posted April 15, 2018 Share Posted April 15, 2018 (edited) 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 April 15, 2018 by Xiija 1 Link to comment Share on other sites More sharing options...
bigmoe Whitfield Posted April 15, 2018 Share Posted April 15, 2018 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. Link to comment Share on other sites More sharing options...
Xiija Posted April 15, 2018 Share Posted April 15, 2018 (edited) 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 April 15, 2018 by Xiija 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now