Page 1 of 1
MineQuery
Posted: Fri Nov 16, 2012 5:59 pm
by JonnyUK
I've followed all tutorials on this and I'm still getting this error!
37.220.18.188
Status: Online
Slots: /
Players:
Warning: implode() [function.implode]: Invalid arguments passed in /home/dnurtcom/public_html/dom/Server/index.php on line 31
http://evolutionservers.net/Server.zip
Re: MineQuery
Posted: Fri Nov 16, 2012 6:06 pm
by Temor
Post your code here using
[syntax=php]
[/syntax] tags.
Re: MineQuery
Posted: Fri Nov 16, 2012 6:13 pm
by JonnyUK
Index.php
<?php
include ('core/init.inc.php');
$info = fetch_server_info($config['server']['ip'], $config['server']['port']);
?>
<html>
<head>
<title><?php echo $config['server']['ip']; ?> Status</title>
</head>
<body>
<div>
<h1><?php echo $config['server']['ip']; ?></h1>
<?php
if ($info = false){
?>
<p>
Status: Offline
</p>
<?php
}else{
?>
<p>
Status: Online
</p>
<p>
Slots: <?php echo $info['playerCount'];?> / <?php echo $info['maxPlayers'];?>
</p>
<p>
Players: <?php echo implode('', $info['playerList']);?>
</p>
<?php
}
?>
</div>
</body>
</html>
error_log
[16-Nov-2012 12:02:30 America/Chicago] PHP Warning: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in /home/dnurtcom/public_html/dom/Server/index.php on line 31
init.inc.php
<?php
$path = dirname(__FILE__);
include ("{$path}/config.inc.php");
include ("{$path}/inc/mc.inc.php");
?>
config.inc.php
<?php
$config['server']['ip'] = '37.220.18.188';
$config['server']['port'] = '25565';
?>
mc.inc.php
<?php
// fetches server information from minequery.
function fetch_server_info($ip, $port){
$socket = fsockopen($ip, $port, $errno, $errstr, 0.5);
if($socket == false){
return false;
}
fwrite($socket, "QUERY_JSON\n");
$response = stream_get_contents($socket);
return json_decode($response, true);
}
?>
Re: MineQuery
Posted: Fri Nov 16, 2012 8:16 pm
by Temor
Do you get the values you were expecting from $info['playerCount'] and $info['maxPlayers'] ?
Re: MineQuery
Posted: Fri Nov 16, 2012 8:35 pm
by JonnyUK
Re: MineQuery
Posted: Fri Nov 16, 2012 10:43 pm
by Temor
if you dump the $info variable, do you get bool(false) ?
var_dump($info);
Re: MineQuery
Posted: Sat Nov 17, 2012 12:02 am
by JonnyUK
Yes I do, check that link I provided
Re: MineQuery
Posted: Sat Nov 17, 2012 12:15 am
by Temor
that means that the function is failing, which means one of these things:
1 You have the wrong IP
2 You have the wrong PORT
3 You don't have access to said IP or PORT
4 The server is down.
Check that everything is correct.
Re: MineQuery
Posted: Sat Nov 17, 2012 12:33 am
by jacek
$config['server']['port'] = '25565';
25565 is the default port for Minecraft, MineQuery runs on 25566 by default so maybe that is worth a try ?
Re: MineQuery
Posted: Sat Nov 17, 2012 3:28 pm
by JonnyUK
Is there anything that I need to do server side?
Re: MineQuery
Posted: Sat Nov 17, 2012 8:40 pm
by JonnyUK
Now the var_dump says NULL
Re: MineQuery
Posted: Tue Nov 20, 2012 12:23 am
by jacek
JonnyUK wrote:Is there anything that I need to do server side?
Install MineQuery ?
http://dev.bukkit.org/server-mods/minequery/