Author Topic: Using TCPObject to send data to a php file.  (Read 750 times)

I've tried everything, googled everywhere.

Can someone please fully explain how to use the send() command?

I've said it before - RTB is based around TCPObjects so go look at that.

I did, I just didn't exactly under stand how to send the post/get data. I see you put "GET FILEPATH HOST:BLAH TORQUETHINGY" but I don't understand where to put the data you want to send. Could you please explain how it should look by default?


send("GET /wp-content/themes/e-wallet/resources.php HTTP/1.0\nHost: destinyrpg.kalphiter.com:80\nUser-Agent: Torque/1.0 datamode='Start';");
Am I doing it right?

EDIT: asdf, didn't work
« Last Edit: February 08, 2009, 05:49:48 PM by Destiny/Zack0Wack0 »

HTTP headers are always separated by a CRNL and I have no idea what you're doing with that datamode stuff.

Alrighty, so I'm trying to change $_GET['datamode'] to something from torque. I'm new to php & html.
« Last Edit: February 08, 2009, 06:34:38 PM by Destiny/Zack0Wack0 »

The correct HTTP form would be this:

GET /wp-content/themes/e-wallet/resources.php?datamode=Start HTTP/1.0\r\nHost: destinyrpg.kalphiter.com\r\nUser-Agent: Torque/1.0\r\n\r\n

EDIT: ops, didn't see ^^, thanks.
EDIT2: Yay it works, cheers.

I think I understand now; correct me if I'm wrong:
I use the URLEncode function by labrat and pass the data I want to set the server side php var to through the URLEncode function.
Then I do this:
Code: [Select]
%data = "datamode = Start";
%httpCmd="GET /wp-content/themes/e-wallet/resources.php HTTP/1.1\nHost: destinyrpg.kalphiter.com:80\nUser-Agent: Torque/1.0 \nAccept: */*\nContent-Length: "@ strlen(%data) @"\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\n\n" @ %data;
TCPObject.send(%httpCmd @ " \r\n");
« Last Edit: February 08, 2009, 06:38:31 PM by Destiny/Zack0Wack0 »