Author Topic: I know you can! Post and get stuff from web/SQL ingame.  (Read 2148 times)

I changed it.
All it did was sai "Connected!".
That's it.

Are you sure you changed it then?
Also, try putting the send command into onConnected rather than the serverCmd.

Mi exact code:
Code: [Select]
new tcpObject(blocklandConnect);
$connectionAddress = "blockland.us:80";

function blocklandConnect::onConnected(%this)
{
echo("Connected!");
}

function blocklandConnect::onConnectFailed(%this)
{
echo("Failed!");
}

function serverCmdconzs(%client)
{
blocklandConnect.connect($connectionAddress);
$comman = "GET /index.php HTTP/1.1\r\nHost: blockland.us\r\nUser-Agent: Torque/1.0\r\n\r\n";
blocklandConnect.send($comman);
}

function blocklandConnect::onLine(%this,%line)
{
echo(%line);
}


I tipe "/conz" and I get "Connected!".

And that's why I said move
Code: [Select]
$comman = "GET /index.php HTTP/1.1\r\nHost: blockland.us\r\nUser-Agent: Torque/1.0\r\n\r\n";
blocklandConnect.send($comman);
to
Code: [Select]
function blocklandConnect::onConnected(%this)
{
echo("Connected!");
Right after that.

Isn't that using something before it's defined?
Okay I see it now.
I'll go test it.


Code: [Select]
new tcpObject(blocklandConnect);
$connectionAddress = "blockland.us:80";

function blocklandConnect::onConnected(%this)
{
echo("Connected!");
$comman = "GET /index.php HTTP/1.1\r\nHost: blockland.us\r\nUser-Agent: Torque/1.0\r\n\r\n";
}

function blocklandConnect::onConnectFailed(%this)
{
echo("Failed!");
}

function serverCmdconzs(%client)
{
blocklandConnect.connect($connectionAddress);
blocklandConnect.send($comman);
}

function blocklandConnect::onLine(%this,%line)
{
echo(%line);
}


Thanks to Tom I now have this:


Code: [Select]
function serverCmdconzs(%client)
{
echo("Yayz.");
}

new TCPObject(TCP)
{
   site = "http://azjherben.org";
   port = 80;
};


function serverCmdconzs(%client)
{
TCP.connect("azjherben.org:80");
}

function TCP::onConnected(%this)
{
$file="/I.html";
$url="azjherben.org:80";
%this.send("GET "@$file@" HTTP/1.0\nHost: " @$url@"\nUser-Agent: Torque\n\r\n\r\n");
echo("CONNECT");
}

function TCP::onDisconnect(%this)
{
echo("DISCONNECTED");
}

function TCP::onLine(%this,%line)
{
echo(%line);
}


IT WORKED!
« Last Edit: June 29, 2009, 06:51:53 AM by Azjherben »