hey all, iam stuck at a big proplem and its how to check if my server is online or n't with SACNR Monitor PHP API please guys help
- - - Updated - - -
Bumb ??? please i need help guys
hey all, iam stuck at a big proplem and its how to check if my server is online or n't with SACNR Monitor PHP API please guys help
- - - Updated - - -
Bumb ??? please i need help guys
You just want to see if it's online or offline?
Would this work?
PHP Code:
<?php
require_once("monitor.php");
$monitor = new SACNR\Monitor;
$res = $monitor->get_info_by_ip('IP', 'Port');
if (is_null($res)) {
echo 'Offline';
} else {
echo 'Online';
}
please what is the right way to import the server information hostname/gamemodename/mapname.... please ???
Should all be stored within $res.
so...{
public $ServerID =>
string(5) "53484"
public $IP =>
string(14) "137.74.179.193"
public $Port =>
string(4) "7777"
public $Hostname =>
string(36) "San Andreas Cops And Robbers (SACNR)"
public $Gamemode =>
string(16) "Cops And Robbers"
public $Language =>
string(0) ""
public $Map =>
string(11) "San Andreas"
public $MaxPlayers =>
string(3) "450"
public $Players =>
string(1) "6"
public $Version =>
string(8) "0.3.7-R2"
public $Password =>
string(1) "0"
public $Time =>
string(20) "Sunday 09:46, Week 2"
public $WebURL =>
string(13) "www.sacnr.com"
public $Rank =>
string(3) "330"
public $AvgPlayers =>
string(5) "17.51"
public $HostedTab =>
string(1) "1"
public $LastUpdate =>
string(10) "1486602794"
public $TotalServers =>
string(4) "1329"
}
would returnPHP Code:
echo $res->Hostname;
San Andreas Cops And Robbers (SACNR)
Last edited by Jamie; 09-02-2017 at 01:23 AM.
please how to check if the server has no players online and please what is the right way to import the online players info playerid/playername/score.... please ???
note: iam converting my my website from another api so iam asking too many questions please help me to convert my websiteas fast as possible please sir
I think it would probably easier if you took some time to learn how to use PHP and echo object properties first.
You can also find all of the public function calls on this page: http://monitor.sacnr.com/api.html
Just var_dump the values for each of the public functions:
You'll probably be looking at get_players_by_ip() and get_query_by_ip().PHP Code:
get_info_by_id(int $server_id)
get_players_by_id(int $server_id)
get_query_by_id(int $server_id)
get_ad_by_id(int $server_id)
get_info_by_ip(string $ip, int $port)
get_players_by_ip(string $ip, int $port)
get_query_by_ip(string $ip, int $port)
get_ad_by_ip(string $ip, int $port)