HTTPObject Unable to Connect to a Server
by Dave Calabrese · in Technical Issues · 08/15/2008 (9:44 am) · 6 replies
I'm attempting to access a simple .PHP file I tossed up on my server. Here is the code I'm using:
Whenever the game runs the 'get' command, I always receive this message in the console:
I'm not exactly sure what the problem here is. I've got all firewalls turned off. It appears to be finding the server (since if I use another web address that does not exist, I get a DNS Lookup Failed message instead). If I type www.gaslightstudios.net/test.php into a web browser, I receive the correct response of "Hello !". Also, no matter what addresss I enter in for my .get address, I get that same error. This also occurs with the .connect() method.
Anyone got any tips on what might be going wrong here?
- Dave Calabrese
Gaslight Studios
$HTTPThingie = new HTTPObject( HTTPClient );
$HTTPThingie.get("www.gaslightstudios.net:80", "/test.php");
function HTTPClient::onLine( %this, %line )
{
error("@@@ Ding!");
}Whenever the game runs the 'get' command, I always receive this message in the console:
Error connecting to www.gaslightstudios.net: No error
I'm not exactly sure what the problem here is. I've got all firewalls turned off. It appears to be finding the server (since if I use another web address that does not exist, I get a DNS Lookup Failed message instead). If I type www.gaslightstudios.net/test.php into a web browser, I receive the correct response of "Hello !". Also, no matter what addresss I enter in for my .get address, I get that same error. This also occurs with the .connect() method.
Anyone got any tips on what might be going wrong here?
- Dave Calabrese
Gaslight Studios
About the author
Recent Threads
#3
http://www.garagegames.com/blogs/27414/15118
my code:
function scoreTest(%name, %score)
{
%server = "$server";
%path = "/uploadScore.php";
%script = "name=" @ %name @ "&score=" @ %score;
%httpObj = new HTTPObject(scoreUploadHTTPObj);
%httpObj.Get(%server, %path, %script);
}
function scoreUploadHTTPObj::onConnectFailed(%this)
{
echo("Connection Failed");
}
function scoreUploadHTTPObj::onConnected(%this) {
echo ("Connected");
}
function scoreUploadHTTPObj::onLine(%this, %line)
{
echo ("Online");
if(getWord(%line, 0) $= "replyData") {
if(getWord(%line, 1) $= "No")
MessageBoxOK("DID NOT UPLOAD SCORE", "Your score has not been uploaded. (Rejected)", "");
else
MessageBoxOK("UPLOADED SCORE", "Your score has been uploaded!", "");
}
}
12/05/2008 (12:55 pm)
I am having the same problem with TGE 1.5 using code from:http://www.garagegames.com/blogs/27414/15118
my code:
function scoreTest(%name, %score)
{
%server = "$server";
%path = "/uploadScore.php";
%script = "name=" @ %name @ "&score=" @ %score;
%httpObj = new HTTPObject(scoreUploadHTTPObj);
%httpObj.Get(%server, %path, %script);
}
function scoreUploadHTTPObj::onConnectFailed(%this)
{
echo("Connection Failed");
}
function scoreUploadHTTPObj::onConnected(%this) {
echo ("Connected");
}
function scoreUploadHTTPObj::onLine(%this, %line)
{
echo ("Online");
if(getWord(%line, 0) $= "replyData") {
if(getWord(%line, 1) $= "No")
MessageBoxOK("DID NOT UPLOAD SCORE", "Your score has not been uploaded. (Rejected)", "");
else
MessageBoxOK("UPLOADED SCORE", "Your score has been uploaded!", "");
}
}
#4
12/05/2008 (12:56 pm)
I also cannot view the link Rene posted and I replaced my actual server addr with the dummy variable $server in the above post
#5
12/05/2008 (1:03 pm)
Sorry 1 more thing, the error I get is that the onLine function is never triggered....
#6
12/05/2008 (5:52 pm)
Make sure that whatever data your server sends to torque has a newline ( \n ) on the end of it. That is how the object will know to call onLine and pass whatever data it received to it.
Associate Dave Calabrese
Cerulean Games
-Dave Calabrese
Gaslight Studios