Game Development Community

Bad Request' from TCPObject

by B. Burton · in Torque Game Engine · 03/18/2008 (3:15 pm) · 2 replies

I am trying to write all chats to a database on another server. The first write works. However, if the client makes any further chats, they do not write, and I receive a Bad Request from the server.
Here is my connection code:
%query = $AuthServer @ "/VLE/chat.php?nick=" @ $pref::chat::NickName ;
         %chat_query = %query @ "&message=" @ %text;
         
         if($chatCounter !$= "1")   // only create the httpChat object once!
            {
            $ChatConnect = new TCPObject(httpChat) {};
            echo("TCPObject intialized!!!");
            $chatCounter = "1";         
            }
         $ChatConnect.get(%chat_query);

I am using the TCPObject as detailed www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=12262
This works great on the first connect, but everything after that just gets the bad request.

Any ideas? I have been trying to figure this out for days!
Brian

#1
03/18/2008 (6:22 pm)
By sending the data through GET, PHP will only receive it when it is first connected. You would need to make a new request for every update.

You could look into using PHP sockets if you need a more persistent connection.
#2
03/25/2008 (1:36 pm)
Okay, this was simpler than it seemed. The problem was that it was passing spaces. I used the
%chat_query = strreplace(%chat_query, " ", "%20");
and the problem was solved.