PHP code example of louixscult / querylabel
1. Go to this page and download the library: Download louixscult/querylabel library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
louixscult / querylabel example snippets
use louixscult\querylabel\QueryHandler;
// returns a ServerQuery obj
$queryData = QueryHandler::query(
'myserver.xyz', // address
19132, // port
3 // tries
)->jsonSerialize(); // suport for serialize the obj
var_dump($queryData);
use louixscult\querylabel\QueryHandler;
$query = QueryHandler::query('myserver.xyz', 19132);
$players = $query->getPlayersCount();
echo 'There are ' . $players . ' players in this server';