Page 1 of 1

HTTP/1.1 400 Bad Request

Posted: Tue Nov 26, 2019 4:25 pm
by Hodo33
This has worked for me in the past and copy/paste to a new app now it does not work. gameone.php exists on the server, just simple code to write to a text file

%data = "code="@$TCPCode @ "&sname="@%sname @ "&wmis="@%mission;

%httpCmd="POST /game/gameone.php HTTP/1.1\nHost:\nUser-Agent: Torque/1.0 \nAccept: */*\nContent-Length: "@ strlen(%data) @"\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\n\n" @ %data;

%this.send(%httpCmd @ " \r\n");

function TCPObj::onLine(%this, %line)
echo("TCP LINE "@%line); // returns HTTP/1.1 400 Bad Request

Anyone know if things have changed since 1.5.2 ?

Re: HTTP/1.1 400 Bad Request

Posted: Wed Dec 04, 2019 5:37 pm
by Hodo33
Bump ... any ideas on this ?
I have a good system for messaging game activity if I can get this working and willing to share.....

Re: HTTP/1.1 400 Bad Request

Posted: Thu Dec 05, 2019 11:24 pm
by Bloodknight
have you tried using something like postman to validate your query?

difficult to analyse without seeing actual data vs collections of variables that could contain anything.

Re: HTTP/1.1 400 Bad Request

Posted: Fri Dec 06, 2019 1:10 am
by Hodo33
What data would you like to see? I am just sending player name and mission number so
1 bob 2 = tcpcode name mission

here is the php. I have been using this for years and just this version I get a bad request

<!DOCTYPE html>
<html lang="en">

$code = $_POST["code"]; // $tcpCode ACTION CALLED BY USER

echo("CODE RECEIVED ".$code);
case 1:
function updateFile()
$name = $_POST["sname"];
$mis = $_POST["wmis"];
$date = date("Y-m-d");
$tab = "\t";
$nl = "\n";
$ipfile = "marsonetrack.txt";
$file = fopen($ipfile, "a");