Jump to content

any help be great


LogenOne
 Share

You are about to reply to a thread that has been inactive for 4253 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am trying to make a php page I can send simple object uuids too.  

For testig I made a prim with this inside

 

integer SECRET_NUMBER=69;
string SECRET_STRING="**bleep**";
key http_request_id;
list uu;
xrequest(string url, list l)
{
integer i;
string body;
integer len=llGetListLength(l) & 0xFFFE; // make it even
for (i=0;i<len;i+=2)
{
string varname=llList2String(l,i);
string varvalue=llList2String(l,i + 1);
if (i>0) body+="&";
body+=llEscapeURL(varname)+"="+llEscapeURL(varvalue);
}
string hash=llMD5String(body+llEscapeURL(SECRET_STRING),SECRET_NUMBER);
http_request_id = llHTTPRequest(url+"?hash="+hash,[HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"],body);
}
default
{
state_entry()
{

}

touch_start(integer total_number)
{

xrequest(" site url",["testpage.php",123,"test","2"]);
}
}

 

I Edit the site url as I do not want any one to see the location atm .

I used this file in my severs main html folder where i store my normal site info.

 

<?php
  // this function tweak slightly urlencode to make it behave exactly like llEscapeURL in Second Life.
  function llEscapeURL($s)
  {
    $s=str_replace(
      array(" ","+","-",".","_"),
      array("%20","%20","%2D","%2E","%5F"),
      urlencode($s));
    return $s;
  }   
 
  // this my main SL page XML-RPC page
  function checkHash()
  {
    global $body;
    $hash=$_GET["hash"];
    $body="";
    $cpt=0;
    $SECRET_NUMBER=123456789;
    $SECRET_STRING="abcdefghi";
 
    foreach ($_POST as $name => $value) {
      if ($cpt++>0) $body.="&";
      if (get_magic_quotes_gpc()) {
        // $name = stripslashes($name); not a good idea though 
        $value = stripslashes($value);
        $_POST[$name]=$value;
      }
      $body.=llEscapeURL($name)."=".llEscapeURL($value);
    }
    $calcHash=md5($body.$SECRET_STRING.':'.$SECRET_NUMBER);
    if ($hash!=$calcHash) 
    {
      sleep(2); // slow down the requests
      echo "result=FAIL\nMSG=Invalid request."; 
      die;
    }
  }
 
  checkHash();
  // You can use the parameters here by simply using $_POST["parameter_name"] 
  echo "OK";
?>


 

 

 

Link to comment
Share on other sites

I placed it in a text file named testpage.php.

I got the information from http://wiki.secondlife.com/wiki/HTTP_Post_request_to_a_PHP_server.

but i get a failed meg error when I open the link,from what i understaood it should have typed

the listt data from the in world prim to the sites php page,

but it just fails msg every time,any clue where i can learn to simple send object uuids to a

php page and have them print it inthe body of that page?

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4253 days.

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
 Share

×
×
  • Create New...