Gregory McLeod Posted September 8, 2014 Share Posted September 8, 2014 I am using an HTTPRequest from a prim script SERVER_REQ_ID = llHTTPRequest( SERVER_URL+"&id="+(string)id, [], "" );I naively thought that all httprequests were accompanied by the Second_life Headers.The one I am missing is X-SecondLife-Owner-Key this results in an php script error and the returned data is invalid.Do you have to use one of the GET or POST methods to get SL to send the full headers? If so I wonder how this used to work, as it did. Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted September 8, 2014 Share Posted September 8, 2014 Did you check the example "example wrapper script Both capturing apache headers and global methodes" here? I assume, this solves your problem. Link to comment Share on other sites More sharing options...
Gregory McLeod Posted September 8, 2014 Author Share Posted September 8, 2014 I assume you mean in the PHP script. If so yes the setting $USE_APACHE_HEADERS = TRUE; but I am so much a beginner at this that I don't know what it means. Help please. Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted September 8, 2014 Share Posted September 8, 2014 I don't know what you used that didn't work - test is with TRUE - if that doesn't work, try FALSE Link to comment Share on other sites More sharing options...
Gregory McLeod Posted September 9, 2014 Author Share Posted September 9, 2014 To try to resolve what I think may be a misunderstanding between us Darkie I show the whole of the PHP script that is being called and the method of calling. The method of calling <q> string SERVER_URL = "http://awebsite.com/folder1/folder2/manager.php?action=UPDATE";key SERVER_REQ_ID;integer id; id = -1; request_server() { SERVER_REQ_ID = llHTTPRequest( SERVER_URL+"&id="+(string)id, [], "" );} other lines of code </q> the receiving website manager.php <q> <?php include_once('bin/DBHandler.php'); $USE_APACHE_HEADERS = TRUE; // switch to false if you need cgi methodsif ($USE_APACHE_HEADERS){ $headers = apache_request_headers(); $objectgrid = $headers["X-SecondLife-Shard"]; $objectname = $headers["X-SecondLife-Object-Name"]; $objectkey = $headers["X-SecondLife-Object-Key"]; $objectpos = $headers["X-SecondLife-Local-Position"]; $ownerkey = $headers["X-SecondLife-Owner-Key"]; $ownername = $headers["X-SecondLife-Owner-Name"]; $regiondata = $headers["X-SecondLife-Region"]; $regiontmp = explode ("(",$regiondata); // cut cords off $regionpos = explode (")",$regiontmp[1]); // $regionname = substr($regiontmp[0],0,-1); // cut last space from simname} else { $db = $GLOBALS; $headers = $db['HTTP_ENV_VARS']; $objectgrid = $headers["HTTP_X_SECONDLIFE_SHARD"]; $objectname = $headers["HTTP_X_SECONDLIFE_OBJECT_NAME"]; $objectkey = $headers["HTTP_X_SECONDLIFE_OBJECT_KEY"]; $ownerkey = $headers["HTTP_X_SECONDLIFE_OWNER_KEY"]; $objectpos = $headers["HTTP_X_SECONDLIFE_LOCAL_POSITION"]; $ownername = $headers["HTTP_X_SECONDLIFE_OWNER_NAME"]; $regiondata = $headers["HTTP_X_SECONDLIFE_REGION"]; $regiontmp = explode ("(",$regiondata); $regionpos = explode (")",$regiontmp[1]); $regionname = substr($regiontmp[0],0,-1);} if(!isset($ownerkey)) { print "INVALID_ACCESS";; } $db = new DBHandler(); function createSurl($reg, $p) { $p = str_replace ( "(" , "" , $p ); $p = str_replace ( ")" , "" , $p ); $c = split ( "," , $p); return "secondlife://$reg/$c[0]/$c[1]/$c[2]";} $action = $_GET['action'];switch($action) { case "UPDATE": $id = $_GET['id']; if( is_numeric ($id) ) { if($id == -1) { $index = $db->getLastIndex() + 1; if($db->addField($index, $ownername, createSurl($regionname, $objectpos))) print "NEW,$index"; else print "Database Error"; } else if($id > 0) { if($db->isField($id)) { if($db->updateField($id, $ownername, createSurl($regionname, $objectpos))) { if($db->isFieldActive($id)) print "ENABLE"; else print "DISABLE"; } else { print "DISABLE"; } } else if($db->addField($id, $ownername, createSurl($regionname, $objectpos))) print "NEW,$index"; else print "Database Error"; } } else print "INVALID"; break;} </q> Note in this PHP script there is an incompatability between the code and the PHP version in the statement <q> function createSurl($reg, $p) { ... $c = split ( "," , $p); ... </q> which is what got me into this mess in the first place. I have fixed that by changing the split to a preg_split as in $c = preg_split( '[(,)]' , $p ); The result that the prim receives from the request is INVALID_ACCESSINVALID which suggest to me that the $ownerkey is not being set. Do you have any comments? Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted September 9, 2014 Share Posted September 9, 2014 Did you try with: $USE_APACHE_HEADERS = FALSE; ? Link to comment Share on other sites More sharing options...
Ron Khondji Posted September 9, 2014 Share Posted September 9, 2014 This PHP script returns all headers. <?php foreach ($_SERVER as $key => $value) { if (strpos($key, 'HTTP_') === 0) { $chunks = explode('_', $key); $header = ''; for ($i = 1; $y = sizeof($chunks) - 1, $i < $y; $i++) { $header .= ucfirst(strtolower($chunks[$i])).'-'; } $header .= ucfirst(strtolower($chunks[$i])).': '.$value; echo $header.'<br>'; } }?> You could check them with: http_response(key id, integer s, list data, string body) { list b = llParseString2List(body, ["<br>"], []); integer l; do { llOwnerSay(llList2String(b, l)); } while (++l < llGetListLength(b)); } Then you know if your owner key header is available or not. Link to comment Share on other sites More sharing options...
Gregory McLeod Posted September 11, 2014 Author Share Posted September 11, 2014 That has provided an answer which works, thank you. I was trying to use the examples in the link provided before and just could not get them to work. Now I have working lsl and php scripts I can expand on them to find out what is happening in my HUD. 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