Page 1 of 1
Problem with MineCraft Server Info Using MineQuery
Posted: Fri Jan 06, 2012 10:00 pm
by Snakybo
Hi, I follwed your tutorial "MineCraft Server Info Using MineQuery" but I get this error:
Warning: include() [function.include]: Failed opening '/home/roensite/public_html/sub/minecraftneo/text/onlinelist/core/config.inc.php}' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/roensite/public_html/sub/minecraftneo/text/onlinelist/core/init.inc.php on line 5
Parse error: syntax error, unexpected T_IF in /home/roensite/public_html/sub/minecraftneo/text/onlinelist/core/inc/mc.inc.php on line 6
This is my code:
<?php
$path = dirname(__FILE__);
include("{$path}/config.inc.php}");
include("{$path}/inc/mc.inc.php");
?>
Anything I did wrong here?
Re: Problem with MineCraft Server Info Using MineQuery
Posted: Fri Jan 06, 2012 10:33 pm
by bowersbros
{$path}/config.inc.php}
You have an } on the end of that line
so it is looking for a file name with config.inc.php} in it, which doesnt exist.
Change to {$path}/config.inc.php
Re: Problem with MineCraft Server Info Using MineQuery
Posted: Fri Jan 06, 2012 11:23 pm
by Snakybo
Thanks, that fixed that but now I get:
Parse error: syntax error, unexpected T_VARIABLE in /home/roensite/public_html/sub/minecraftneo/text/onlinelist/core/config.inc.php on line 4
<?php
$path = dirname(__FILE__);
include("{$path}/config.inc.php");
include("{$path}/inc/mc.inc.php");
?>
Re: Problem with MineCraft Server Info Using MineQuery
Posted: Sat Jan 07, 2012 12:05 am
by bowersbros
can you post the code for the two included pages ?
Especially the config page since the error is relating to that one.
If you read the error, it tells you what it is.
Unexpected Variable declared n config.inc.php near to line 4.
Eg, look at line 3. Most likely there is a semi colon missing.
Re: Problem with MineCraft Server Info Using MineQuery
Posted: Sat Jan 07, 2012 11:58 pm
by Snakybo
Oh thanks, managed to fix some forgotten ";"'s
Anyways, I also did like he said to hide this error message if it can't connect to the server:
Warning: fsockopen() [function.fsockopen]: unable to connect to 86.80.237.30:25566 (Connection timed out) in /home/roensite/public_html/sub/minecraftneo/text/onlinelist/core/inc/mc.inc.php on line 4
86.80.237.30:1337
Currently Offline!
Here's the PHP:
<?php
function fetch_server_info($ip, $port){
$socket = fsockopen($ip, $port, $errno, $errstr, 0.5);
if ($socket === false){
return false;
}
fwrite($socket, "QUERY_JSON\n");
$responce = stream_get_contents($socket);
return json_decode($responce, true);
}
?>
Anything wrong with that?
Re: Problem with MineCraft Server Info Using MineQuery
Posted: Sun Jan 08, 2012 12:50 am
by jacek
Snakybo wrote:Anything wrong with that?
Looks okay to me, does it work ?
Re: Problem with MineCraft Server Info Using MineQuery
Posted: Sun Jan 08, 2012 12:55 am
by Snakybo
Not sure yet, need to fix my WiFi to turn the server on
Re: Problem with MineCraft Server Info Using MineQuery
Posted: Sun Jan 08, 2012 12:55 am
by bowersbros
Is the port number definately right?
Re: Problem with MineCraft Server Info Using MineQuery
Posted: Sun Jan 08, 2012 12:56 am
by Snakybo
bowersbros wrote:Is the port number definately right?
Should be, I didnt change the default MineQuery port