Jump to content

HTTP/1.1 400 Bad Request


Hodo33

Recommended Posts

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: www.myweb.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;


%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 ?

Link to comment
Share on other sites

  • 2 weeks later...

<?php


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


echo("CODE RECEIVED ".$code);

switch($code)

{

case 1:

updateFile();

break;

}

function updateFile()

{

$ip = $_SERVER['REMOTE_ADDR']; // THIS IP SENT MESSAGE

$name = $_POST["sname"];

$mis = $_POST["wmis"];

$date = date("Y-m-d");

$tab = "\t";

$nl = "\n";

$ipfile = "marsonetrack.txt";

$file = fopen($ipfile, "a");

fwrite($file,$date.$tab.$ip.$tab.$name.$tab.$mis.$nl);

fclose($file);

echo("ok");

}

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...