[HELP] Minequery Server Status Checker

Post here is you are having problems with any of the tutorials.
Post Reply
antony96
Posts: 3
Joined: Thu Sep 15, 2011 4:55 pm

[HELP] Minequery Server Status Checker

Post by antony96 »

Hi,
I saw your videotutorial about making a minequery server status checker and copied all the code succesfully without errors... But when I open index.php (the page that echoes you the server status) in my browser, it shows that the server is offline also if it is up and accepting players.
I forwarded all my ports (the MC server is on 25566 and minequery on 25567, I also use no-ip to get a DDNS) so everyone can see me over the net...
IDK why this happens, can you help me?
However I'm hosting this script on a freehostia free web hosting...

Code:
<?php

include("core/init.inc.php");

$info = fetch_server_info($config['server']['ip'], $config['server']['port']);

?>
<html>

<head>
<title></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>
I also want to say that I am already registered on MineStatus.net and there the Server Status Checker works without problems...
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: [HELP] Minequery Server Status Checker

Post by jacek »

You could try turning the timeout up a little, if that does not help can you post the code of the other files ?
Image
antony96
Posts: 3
Joined: Thu Sep 15, 2011 4:55 pm

Re: [HELP] Minequery Server Status Checker

Post by antony96 »

I tried with 30 timeout at the maximum but it does the same...
Here are the other files (however i copied yours without modifying anything...):

config.inc.php
<?php

$config['server']['ip'] = 'btk.servegame.com';
$config['server']['port'] = '25567';

?>
init.inc.php
<?php

$path = dirname(__FILE__);

include("{$path}/config.inc.php");
include("{$path}/inc/mc.inc.php");

?>
mc.inc.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");
	
	$response = stream_get_contents($socket);
	
	return json_decode($response, true);
}

?>
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: [HELP] Minequery Server Status Checker

Post by jacek »

Well the connection is not being created for some reason, make sure the address and port are correct.

Also it might be a good idea to try adding
echo $errstr;
after the fsockopen line to see I that tells you why the connection fails.

You could also trying replacing the IP with google.com and the port with 80 which should show as online to see if it is some restriction put in place by your host.
Image
MrBotox
Posts: 1
Joined: Wed Oct 05, 2011 7:35 pm

Re: [HELP] Minequery Server Status Checker

Post by MrBotox »

This can sometimes be to do with your web hosts, I made a script abit like this one and it worked locally using my wamp server however when i uploaded it to my web hosts it stopped working, so i moved to a new host and it worked perfectly.

If your still having this problem i suggest changing hosts :)

MrBotox.
Post Reply