After a long search on the web to find this kind of script, the only solution proposed always brings back to this site "starmade-servers.com".
And if I do not want to register on this site who want to keep the monopoly how I do?
Well, there is an alternative, thanks to starnet, it is possible, I have searched for a long time because I am not a developer and my knowledge in coding is quite limited so if like me you are not at the " ease to do this kind of thing I hope this script will help you.
Note that a copy of starnet.jar must be placed for the following case in the same directory as the page.php of the script and that the lines of the server.cfg must be filled:
SUPER_ADMIN_PASSWORD_USE = true
SUPER_ADMIN_PASSWORD = yourpassword
Example for the command "/ status", 000.000.000.000 must be replaced by the IP address of the server.
Now, if I want to refine and display only string 4:
To format:
This opens up other possibilities for the imagination and the needs.
And if I do not want to register on this site who want to keep the monopoly how I do?
Well, there is an alternative, thanks to starnet, it is possible, I have searched for a long time because I am not a developer and my knowledge in coding is quite limited so if like me you are not at the " ease to do this kind of thing I hope this script will help you.
Note that a copy of starnet.jar must be placed for the following case in the same directory as the page.php of the script and that the lines of the server.cfg must be filled:
SUPER_ADMIN_PASSWORD_USE = true
SUPER_ADMIN_PASSWORD = yourpassword
Example for the command "/ status", 000.000.000.000 must be replaced by the IP address of the server.
Code:
<?php
exec("java -jar StarNet.jar 000.000.000.000:4242 yourpassword /status 2>&1", $output);
preg_match("/RETURN: \[SERVER, Players: ([0-9]+) \/ ([0-9]+), 0\]/", $output, $matches);
var_dump ($output);
?>
Now, if I want to refine and display only string 4:
Code:
<?php
exec("java -jar StarNet.jar 000.000.000.000:4242 yourpassword /status 2>&1", $output);
preg_match("/RETURN: \[SERVER, Players: ([0-9]+) \/ ([0-9]+), 0\]/", $output[4], $matches);
var_dump ($output[4]);
?>
To format:
Code:
<?php
exec("java -jar StarNet.jar 000.000.000.000:4242 yourpassword /status 2>&1", $output);
preg_match("/RETURN: \[SERVER, Players: ([0-9]+) \/ ([0-9]+), 0\]/", $output[4], $matches);
$nbrplayer = $matches[1]; $maxplayer = $matches[2];
print_r ("$nbrplayer / $maxplayer");
if ($nbrplayer == $maxplayer) { echo "Server off"; }
?>