Jump to content

Sending data to SL from GoDaddy hosting


NeevaBecketEmagan
 Share

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

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

Recommended Posts

Hi

I'm working in an object that need to receive commands from the php webserver. My host is GoDaddy, and I think that it is my problem :/

I tried several tutorials but none worked. 

If I use the port 12046 I got the error 'connection refused', because the hosting allows only port 80 (or 443 for https). But if I use port 80 I get a "connection timed out" error and no data is sent to the object.

The php code I'm using is:

<?php


$url = 'http://sim10405.agni.lindenlab.com:80/cap/700042c9-349e-a548-4e03-ef8834226135';//the URL of your object goes here
echo "Request answered<br>";
$Data = CallLSLScript($url, "C001");
die($Data);

function CallLSLScript($URL, $Data, $Timeout = 10) {  	
	echo  "callscript: ".$URL."<br>";   //Parse the URL into Server, Path and Port   
	$Host = str_ireplace("http://", "", $URL);   
	$Path = explode("/", $Host, 2);   
	$Host = $Path[0];   
	$Path = $Path[1];   
	$PrtSplit = explode(":", $Host);   
	$Host = $PrtSplit[0];   
	$Port = $PrtSplit[1];   //Open Connection   
	$Socket = fsockopen($Host, $Port, $Dummy1, $Dummy2, $Timeout);   
	echo "<br>socket: ".$Socket."<br>";   
	if ($Socket)   {      //Send Header and Data      
		fputs($Socket, "GET /$Path HTTP/1.1\r\n");
		fputs($Socket, "Host: $Host\r\n");
		fputs($Socket, "Content-type: application/x-www-form-urlencoded\r\n");
		fputs($Socket, "User-Agent: Opera/9.01 (Windows NT 5.1; U; en)\r\n");
		fputs($Socket, "Accept-Language: de-DE,de;q=0.9,en;q=0.8\r\n");
		fputs($Socket, "Content-length: ".strlen($Data)."\r\n");
		fputs($Socket, "Connection: close\r\n\r\n");
		fputs($Socket, $Data);
		//Receive Data
		while(!feof($Socket))
			{$res .= fgets($Socket, 128);}
		fclose($Socket);
		echo "sent<br>";
    }
	//return the data to the bowser	
	echo $res;}
	
?>

How I can solve it? I can't chance the host company, nor use other port than 80.

Have anyone used GoDaddy for it and was successfull?

The LSL script is this one:

string url;
key urlRequestId;

setup()
{
    llReleaseURL(url);
    url = "";
    urlRequestId = llRequestURL();
}

default
{
    state_entry()
    {
        setup();
    }

    on_rez(integer n) { setup(); }
 
    changed(integer c)
    {
        if (c & (CHANGED_REGION | CHANGED_REGION_START | CHANGED_TELEPORT) )
        {
            setup();
        }
		if (c & CHANGED_REGION_START){
			llInstantMessage(llGetOwner(),"Region restart");
		}
    }
	
    touch_start(integer total_number)
    {
        llOwnerSay("My URL is: "+url);
    }
	
    http_request(key id, string method, string body)
    {
        if (method == URL_REQUEST_GRANTED)
        {
            url = body;
            llOwnerSay("My URL is: "+url);
        }
        else if (method == URL_REQUEST_DENIED)
        {
            llOwnerSay("Something went wrong, no url. " + body);
        }
        else if (method == "POST")
        {
			llOwnerSay("Received from server: "+body);
			
            list param_values = llParseString2List(body,["|"],[]);
			key send_to = llList2Key(param_values,1);
			string seed = llList2String(param_values,2);

			llGiveInventory(llGetOwner(),seed);
			
            llHTTPResponse(id,200,"Seed sent!");
        }
        else
        {
            llHTTPResponse(id,405,"Method unsupported");
        }
    }

}

 

Link to comment
Share on other sites

Their PHP settings might be disallowing remote scripted objects connecting even to the one port they give to their users. PHP is notorious for not having all of its security issues worked out, so a lot of hosts use super-paranoid settings in the PHP configs, disabling a lot of functionality. PHP itself tends to ship in server packages with many of its features disabled, such as being able to upload a file(!). A lot of it is just a lack of willingness to learn how to configure it properly, and a lot of it is a desire to simply avoid their users being able to do anything other than serve web pages.

I used a very reliable and expensive web host for several years and they were almost as limited and restricted. My "unlimited access account complete with shell access" wouldn't let me compile a simple binary via the remote shell.

Not to disparage any particular hosting company, but the majority of them I've encountered really tend to either be out of touch with what some of their customers would like to be able to do for their money, or just don't care as long as the majority of their users are happy paying a hundred bucks or more a year for the equivalent of a homepage. Sigh.

Edited by Berksey
Link to comment
Share on other sites

A few years ago, when I first started looking into HTTP-In, The scripts did not work with my host (I have used Hostgator loyally for many years). But, as the wiki says, most hosts don't have these ports open. I called my host, explained what I needed, and they were opened immediately.

I don't know if you've tried calling GoDaddy, but it's worth a try.. and if they won't, I can tell you that Hostgator will. ;-)

It's probably worth mentioning that I didn't have to do anything myself (php.ini editing or whatnot). I simply made a call, made my request, was told I was all set, and the script started working as intended.

  • Like 1
Link to comment
Share on other sites

On 4/28/2017 at 11:47 PM, Berksey said:

I feel awful for not even thinking of suggesting something as obvious as calling customer support. Mea culpa.

Thankfully, the poster above me was more on the ball.

It's not really a surprise that "customer support" isn't the first thing we think of... I mean, it is an oxymoron, isn't it? lol

Link to comment
Share on other sites

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