Page 1 of 1

Web server status?

Posted: 03 Nov 2018 22:15
by helliaby
Hi everyall

Is it possible to have the status of my TrackMania server on my website? Only appear Status - Running Play Players 5/50 and such?

:ftw: :ftw: :ftw: :ftw:

Re: Web server status?

Posted: 04 Nov 2018 09:20
by Xymph
helliaby wrote:
03 Nov 2018 22:15
Is it possible to have the status of my TrackMania server on my website? Only appear Status - Running Play Players 5/50 and such?
Sure:

Code: Select all

#!/usr/bin/php -q
<?php
	$ip   = '127.0.0.1';    // IP address of server
	$port = YourPort;       // Port for remote access
	$user = 'SuperAdmin';   // Server Login
	$pass = 'YourPassword'; // Login Password

	require('PathTo/includes/GbxRemote.inc.php');
	$client = new IXR_Client_Gbx;

	if (!$client->InitWithIp($ip, $port)) {
		echo 'Cannot connect - ' . $client->getErrorCode() . ': ' . $client->getErrorMessage() . "\n";
		exit;
	}
	if (!$client->query('Authenticate', $user, $pass)) {
		echo 'Cannot authenticate - ' . $client->getErrorCode() . ': ' . $client->getErrorMessage() . "\n";
		exit;
	}

	if (!$client->query('GetStatus')) {
		echo 'Cannot get status - ' . $client->getErrorCode() . ': ' . $client->getErrorMessage() . "\n";
		exit;
	}
	$status = $client->getResponse();
	print_r($status); // do your own formatting here

	// repeat for other methods
?>

Re: Web server status?

Posted: 05 Nov 2018 00:00
by helliaby
Hi, thanks for answering me so fast. But it does not work, I get the error 500

Re: Web server status?

Posted: 06 Nov 2018 07:52
by Xymph
helliaby wrote:
05 Nov 2018 00:00
Hi, thanks for answering me so fast. But it does not work, I get the error 500
The script is fine, but there could be various reasons (wrong configuration, blocked port, etc.) why it doesn't work in your set-up. It's up to you to debug that.

Re: Web server status?

Posted: 06 Nov 2018 18:28
by undef.de
helliaby wrote:
05 Nov 2018 00:00
Hi, thanks for answering me so fast. But it does not work, I get the error 500
This script isn't meant to be used by HTTP, it's a console script.

Re: Web server status?

Posted: 07 Nov 2018 21:46
by helliaby
thanks for your clarification. In this case, for console, how is that? I do not understand, I thought it was accessible from HTTP. What should I do to make it accessible from the page? in this case done through Joomla

Re: Web server status?

Posted: 08 Nov 2018 17:27
by undef.de
helliaby wrote:
07 Nov 2018 21:46
In this case, for console, how is that? I do not understand.
XAseco (for example) is a console script too, which also do not run by HTTP. Details about console/cli: http://php.net/manual/en/features.comma ... uction.php
helliaby wrote:
07 Nov 2018 21:46
What should I do to make it accessible from the page? in this case done through Joomla
You have to change the script (which also is just a short example how to do it) to be a plugin for Joomla.

Re: Web server status?

Posted: 11 Nov 2018 21:06
by helliaby
Hi. I found this: https://github.com/cyco77/gameserver

I have installed it on my website, but it does not work. It is ensured that the ports are not blocked. Will I have to edit something?

Re: Web server status?

Posted: 12 Nov 2018 15:07
by undef.de
helliaby wrote:
11 Nov 2018 21:06
Hi. I found this: https://github.com/cyco77/gameserver

I have installed it on my website, but it does not work. It is ensured that the ports are not blocked. Will I have to edit something?
That won't work, because it's not for TM (I didn't saw anything about TM there). Maybe the "Website Stats for TMF" which can be found at http://www.xaseco.org/tools.php could be a thing for you. But that's not a Joomla!-Plugin, it's a stand-alone software.

Re: Web server status?

Posted: 17 Nov 2018 22:59
by helliaby
Thx a lot! It was really what I was looking for