Elanes Aeon Posted September 2, 2013 Share Posted September 2, 2013 Hello I am trying to use the http_request and the POST method in my script but I have an issue How Would I make a PHP script pass info to the objects URL and how to I get that info in the object LSL to use it?Would love any help been looking on the Wiki but I can't seem to find any info or Examples on how to do this Thanks! Link to comment Share on other sites More sharing options...
Elanes Aeon Posted September 2, 2013 Author Share Posted September 2, 2013 Hello I am trying to use the http_request and the POST method in my script but I have an issue How Would I make a PHP script pass info to the objects URL and how to I get that info in the object LSL to use it?Would love any help been looking on the Wiki but I can't seem to find any info or Examples on how to do this Thanks! Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted September 2, 2013 Share Posted September 2, 2013 Look at this page http://wiki.secondlife.com/wiki/LSL_http_server/Exemplar - torwards the endlich you'll find a PHP exemplar. In thing to mind is, that your server allows calls to odd Ports. Most don't. Link to comment Share on other sites More sharing options...
xtc4u Posted September 2, 2013 Share Posted September 2, 2013 Here is the correct link: http://wiki.secondlife.com/wiki/LSL_http_server/examples Link to comment Share on other sites More sharing options...
Elanes Aeon Posted September 2, 2013 Author Share Posted September 2, 2013 Ok i have got my script set up here http://opps.incarnate.me/test.php and the corect URL is placed in the script for the object and had my hosting Co. open the PORTS needed but nothing happens dose anyone know if this set up still works? <?phpecho "LSL Script answered:<br>";echo Advanced_HTTP_Request("http://sim10186.agni.lindenlab.com:12046/cap/9a733888-9d5e-e247-869c-880046423bbb", "Hello script, how are you ?"); function Advanced_HTTP_Request($Host, $PostData = ""){ $Method = "POST"; if (empty($PostData)) {$Method = "GET";} $Port = 80; if (strtolower(substr($Host, 0, 5)) == "https") {$Port = 443;} $Host = explode("//", $Host, 2); if (count($Host) < 2) {$Host[1] = $Host[0];} $Host = explode("/", $Host[1], 2); if ($Port == 443) {$SSLAdd = "ssl://";} $Host[0] = explode(":", $Host[0]); if (count($Host[0]) > 1) { $Port = $Host[0][1]; $Host[0] = $Host[0][0]; } else {$Host[0] = $Host[0][0];} $Socket = fsockopen($SSLAdd.$Host[0], $Port, $Dummy1, $Dummy2, 10); if ($Socket) { fputs($Socket, "$Method /$Host[1] HTTP/1.1\r\n". "Host: $Host[0]\r\n". "Content-type: application/x-www-form-urlencoded\r\n". "User-Agent: Opera/9.01 (Windows NT 5.1; U; en)\r\n". "Accept-Language: de-DE,de;q=0.9,en;q=0.8\r\n". "Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n". "Content-length: ".strlen($PostData)."\r\n". "Connection: close\r\n". "\r\n". $PostData); $Tme = time(); while(!feof($Socket) && $Tme + 30 > time()) {$Res = $Res.fgets($Socket, 256);} fclose($Socket); } $Res = explode("\r\n\r\n", $Res, 2); return $Res[1];}?> this is the Code as it is on the Test.php i try calling it in the URL but nothing... Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted September 2, 2013 Share Posted September 2, 2013 Do you get a socket at all? Remember what I said in my last post - many Hosting providers won't let you Link to comment Share on other sites More sharing options...
Elanes Aeon Posted September 2, 2013 Author Share Posted September 2, 2013 I called them they open the ports... there is no reason i should not be loading. Link to comment Share on other sites More sharing options...
Elanes Aeon Posted September 2, 2013 Author Share Posted September 2, 2013 i have talked this over with my hosting provider the ports and sockets are open on there end for incoming and outgoing trafic, but if they try to telnet in they are getting a refused connection. Link to comment Share on other sites More sharing options...
Elanes Aeon Posted September 2, 2013 Author Share Posted September 2, 2013 I use Hostmonster all ports are open why would it refuse connect from there servers? Link to comment Share on other sites More sharing options...
Ron Khondji Posted September 2, 2013 Share Posted September 2, 2013 I tried this little script: key HTTP;default{ touch_start(integer total_number) { HTTP = llHTTPRequest("http://opps.incarnate.me/test.php", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], ""); } http_response(key request_id, integer status, list metadata, string body) { if (request_id == HTTP) { llOwnerSay("Status: " + (string)status + "\nBody: " + body); } }} This is what I got back: [08:44] Object: Status: 200 Body: LSL Script answered:<br> Which makes me think your php script and server are working just fine. Allthough I'm probably missing the point completely Link to comment Share on other sites More sharing options...
Elanes Aeon Posted September 2, 2013 Author Share Posted September 2, 2013 yes , yes you are but thank you. Link to comment Share on other sites More sharing options...
Elanes Aeon Posted September 2, 2013 Author Share Posted September 2, 2013 is there not any one out there using this set up and that it is working for? Link to comment Share on other sites More sharing options...
PeterCanessa Oh Posted September 2, 2013 Share Posted September 2, 2013 What's meant to happen that isn't? You've shown us some PHP, how about some LSL? Will you be answering Darkie's rather pertinent question any time? Link to comment Share on other sites More sharing options...
Elanes Aeon Posted September 3, 2013 Author Share Posted September 3, 2013 Well sence Darkie sent me to the site where the code is he knows the code and what it is to do all you would need to do is look on the wiki as well to see it, but as far as answering his i did yes the Ports on my host are open No i am not getting a socket LL is refusing the connection from my Host. LOL Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted September 3, 2013 Share Posted September 3, 2013 Here some things that come to my mind: - Are you sure that you use the correct URL and update it on each llRequstURL() call - What message do you actually get? - What happens, it you call the scipt's URL from a web browser - does it responde as expected? Link to comment Share on other sites More sharing options...
PeterCanessa Oh Posted September 3, 2013 Share Posted September 3, 2013 In one of my recent posts I gave the site of a programme I am copying. It doesn't work, why won't you fix it for me? Without a more detailed and expanded explanation of exactly what's happening and what's not you're really making it hard for us to help you. So I'm off to debug my own program. Have fun. Link to comment Share on other sites More sharing options...
Elanes Aeon Posted September 3, 2013 Author Share Posted September 3, 2013 :matte-motes-big-grin-wink: ok, i run script nothing happens how else am i to tell you what its not doing if it DOES NOTHING lol. But this is no longer an issue i found out the issue is my host so i changes host and it works just fine now... but thank you to the members that realy did help me. Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted September 3, 2013 Share Posted September 3, 2013 So it was closed outgoing ports after all 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