Game Development Community

HTTPObject php request not working

by Quentin Headen · in General Discussion · 07/28/2009 (6:39 pm) · 0 replies

Hello everyone! I am making a game and I want to communicate with my web server. I am using php, and the script returns something based on the query. Basically, it is a php calculator using a get request. I made it to test TGE 1.5.2's HTTPObject. Here is my code

function TestCalculator()
{
   %server = "mywebserver.com:80";
   %filePath = "/ajax/calculator/calculate.php";
   %query = "?firstNumber=5&secondNumber=5&operation=add";


  %http = new HTTPObject(HTTP);

  %http.get(%server, %filePath, %query);
}

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

So what it is supposed to do is use the firstNumber, secondNumber, and operation GET variables to pass to the php calculator script. Then the script returns the value. When I call get() on the object I (through SSH) track the Apache log on my server and I see that it did send a request. It isn't returning anything though. My php script doesn't return anything only if the query arguments aren't passed. So this tells me that the content in the %query variable aren't being sent to the server. What is the problem?

Thanks

P.S. It works fine when accessing a page that requires no GET arguments

About the author

Just your average programmer who tries to finish the projects he starts. :) I am currently focused on creating games with Torque engines. My website is http://phaseshiftsoftware.com