Jump to content

can't get php to communicate with my script (IT USED TO BEFORE)


LeNinBiscuit Torok
 Share

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

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

Recommended Posts

Hi, I have modified the below script from the wiki to work with my LSL and database needs.  Coming back to a project I find it doesnt work any more.

Has lindenlab.com changed IP or something?  My web host and me are going round and round about these open ports. The old setting of opening outbound access to 75.101.145.87 on ports 12046 and 12043 no longer seems to work for fsockopen() in php.
.

Doing my head in, please help: ).

 

-LeNin

 

P.S. This test on my webhost fails:

<?php

$site = "75.101.145.87"; //lindenlab.com
$port = 12046; //port required

$fp = @fsockopen($site, $port, $errno, $errstr, 10);

if(!$fp){echo "$errstr($errno)<br>\n";
echo "<b>The port is NOT open!</b>";
}else{
echo "<b>The port is open!</b>"; //this fails
fclose($fp);
}
?>

Excerpt from thr wiki that fails:

...................................

<?php
echo "LSL Script answered:<br>";
echo Advanced_HTTP_Request("https://sim20557.agni.lindenlab.com:12043/cap/5851e666-b0c6-f0a0-758a-9e8156765215", "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];
}
?>


Link to comment
Share on other sites

I don't really have an answer, but I tested your examples:

  1. The first test failed for me as well.
  2. If I use the IP for a sim instead of the IP for linden lab, this script ceates a socket just fine
  3. the second script works like a scharm (with regulat http - I haven't tryed https)

My conclusion from that is:

You have a problem on your side - which could have many reasons - the most common being that the port is not open for outgoing connections - but I gather, that you've been working on that.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3647 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...