File: /home/windevelwb/www/api2/liste.php
<?php
header("Content-Type: application/json; charset=utf-8");
// Charger les fichiers JSON
$macsFile = __DIR__ . "/data/macs.json";
$portalsFile = __DIR__ . "/data/portals.json";
// Lire les fichiers
$macs = file_exists($macsFile) ? json_decode(file_get_contents($macsFile), true) : [];
$portals = file_exists($portalsFile) ? json_decode(file_get_contents($portalsFile), true) : [];
// NE GARDER QUE 20 MACS
$macs = array_slice($macs, 0, 20);
// Structure JSON propre
$response = [
"xtream" => isset($portals["xtream"]) ? $portals["xtream"] : [],
"stalker" => isset($portals["stalker"]) ? $portals["stalker"] : [],
"macs" => $macs
];
// Retour JSON propre
echo json_encode($response);