2022-03-01, 02:42 PM
Alright. So here is my custom mybb page. The thing is, I've put some php in it, but I have no idea how to display it in a table or div. It lands under the footer at the moment.
Appreciate any help!
Thanks in advance!
// Replace XXXXXX by your server id on Trackyserver.com
$server_id = "1683849";
// Execute curl and get server informations
$url="https://api.trackyserver.com/widget/index.php?id=".$server_id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$result=json_decode(curl_exec($ch), true);
curl_close($ch);
if ($result){
// Example to print playerscount
echo $result['playerscount'];
echo $result['map'];
// Example to loop players list
foreach ($result['playerslist'] as $player){
echo $player['name'];
}
// Use print_r($result); to print all informations array
} else {
echo "server not found";
}
Appreciate any help!
Thanks in advance!
// Replace XXXXXX by your server id on Trackyserver.com
$server_id = "1683849";
// Execute curl and get server informations
$url="https://api.trackyserver.com/widget/index.php?id=".$server_id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$result=json_decode(curl_exec($ch), true);
curl_close($ch);
if ($result){
// Example to print playerscount
echo $result['playerscount'];
echo $result['map'];
// Example to loop players list
foreach ($result['playerslist'] as $player){
echo $player['name'];
}
// Use print_r($result); to print all informations array
} else {
echo "server not found";
}