Query string not sent with HTTPObject
by Dylan Fitterer · in Torque Game Builder · 08/17/2005 (1:21 am) · 7 replies
I'm trying to use Torque's HTTPObject to view an online highscore table. The query string doesn't seem to be getting to my webserver.
It does connect to the server, but the string I get back is an error. It's exactly the text that comes back if scorekeeper.php is called without a query string.
Any ideas?
function gameOver(){
$isEndGame = true;
$httpObject = new HTTPObject(HTTP);
$httpObject.get("www.somedomain.com:80", "/highscores/scorekeeper.php", "?filename=testgame.scores&viewtype=STRING");
}
function HTTP::onLine( %this, %line ){
echo(%line);
}It does connect to the server, but the string I get back is an error. It's exactly the text that comes back if scorekeeper.php is called without a query string.
Any ideas?
#2
By this I'm given the impression that your viewtype=STRING is getting chopped off at the very least, so you may want to check out the last engine mod in the above resource.
08/17/2005 (7:53 am)
There is a resource (Persistant Character Server) that has a blurb about adding support to escape &'s in the query string. The author says:Quote:
What this does is allows you to use the text tag \t as & in your get variable strings allowing you to send multiple variables in a single query. (TGE normally dosnt support this and & get turned into its hex equivalent)
By this I'm given the impression that your viewtype=STRING is getting chopped off at the very least, so you may want to check out the last engine mod in the above resource.
#3
08/17/2005 (11:22 am)
Luke is correct. I had to modify HTTPObject::expandPath() to allow the question mark to be passed through correctly.
#4
The "?" was removed and the "&" was replaced with "\t".
08/17/2005 (1:33 pm)
Thanks guys. I followed Luke's link and got it working. Apply the engine modification which allows you to use "&" in your query string. Then script code like this:function gameOver(){
$isEndGame = true;
$httpObject = new HTTPObject(HTTP);
$httpObject.get("www.somedomain.com:80", "/highscores/scorekeeper.php", "filename=testgame.scores\tviewtype=STRING");
}
function HTTP::onLine( %this, %line ){
echo(%line);
}The "?" was removed and the "&" was replaced with "\t".
#5
05/21/2006 (4:35 pm)
OK, so why isn't this working for me? I'm using TGB but the C++ side looks the same what's the deal? How can you allow for the question mark?
#6
My last plan might be of some interest. Even without using the TCPObject the URLEncode functions would probably be worth looking at.
06/14/2006 (10:07 am)
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10202My last plan might be of some interest. Even without using the TCPObject the URLEncode functions would probably be worth looking at.
#7
07/26/2011 (8:39 am)
can u teach me how to connect to the server
Associate Kevin Ryan
Top Meadow Inc.
$httpObject.get("www.somedomain.com:80", "/highscores/scorekeeper.php?filename=testgame.scores&viewtype=STRING");