Seguro no vas a leer y no te va a salir xd te ahorro el trabajo
Descargate ese repositorio y en la carpeta raíz te creas index.php y le pegas esto:
https://prnt.sc/sn4aag
si tenes dudas que datos podes usar printea esto
print_r($results);
Descargate ese repositorio y en la carpeta raíz te creas index.php y le pegas esto:
Código PHP:
<?php
require_once('src/GameQ/Autoloader.php');
$ip = '199.127.62.238:27015';
$GameQ = new \GameQ\GameQ();
$GameQ->addServer([
'type' => 'cs16',
'host' => $ip,
]);
$GameQ->setOption('timeout', 5);
$results = $GameQ->process();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
</head>
<body>
<table class="table table-striped table-dark table-hover">
<thead class="thead-dark">
<tr> <th class="text-center" colspan="3"><?= $results[$ip]['hostname'] ?> <br> <?= $results[$ip]['num_players']. '/' .$results[$ip]['max_players']; ?></th></tr>
</thead>
<tr class="table">
<th>#</th>
<th>PlayerName</th>
<th>Scorer</th>
</tr>
<?php
for($i = 0; $i< count($results[$ip]['players']); ++$i){
echo'
<tr>
<td>'. $results[$ip]['players'][ $i ][ 'id' ] .'</td>
<td>'. $results[$ip]['players'][ $i ][ 'name' ] .'</td>
<td>'. $results[$ip]['players'][ $i ][ 'score' ] .'</td>
</tr>
';
}
?>
</table>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" ></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
</body>
</html>
https://prnt.sc/sn4aag
(24/05/2020, 11:04 PM)andres_1041 escribió: EDIT: Me tira error https://prnt.sc/sn49w4stemen, usa la cagada que deje ahí
Código PHP:<?php
require_once('Autoloader.php')
$GameQ = new \GameQ\GameQ();
$GameQ->addServer([
'type' => 'css',
'host' => '149.28.109.129:27515',
]);
$GameQ->setOption('timeout', 5);
$results = $GameQ->process();
echo $results['num_players'];
echo $results['max_players'];
?>
Aquí
[/font]Código PHP:$GameQ = new \GameQ\GameQ();
si tenes dudas que datos podes usar printea esto
print_r($results);