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>core/config.inc.php
<?php $config['server']['ip'] = 'robinatorzzzz.zapto.org'; $config['server']['port'] = '25565'; ?>core/init.inc.php
<?php $path = dirname(__FILE__); include ("{$path}/config.inc.php"); include ("{$path}/inc/mc.inc.php"); ?>core/inc/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); } ?>The errors i get...
Erro NR 1 (When the server is offline)
Warning: fsockopen() [function.fsockopen]: unable to connect to robinatorzzzz.zapto.org:25565 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\xampp\htdocs\workspace\minecraft server - minequery\core\inc\mc.inc.php on line 5
Output:
robinatorzzzz.zapto.org
Status: Offline
Erro NR 2 (When the server is online)
Warning: implode() [function.implode]: Invalid arguments passed in C:\xampp\htdocs\workspace\minecraft server - minequery\index.php on line 31
Output:
robinatorzzzz.zapto.org
Status: Online
Slots: /
Players:
Thnx in advance!!