version_compare(PHP_VERSION, '7.4.0', '>='), 'value' => PHP_VERSION, 'msg' => 'PHP 7.4 ou supérieur recommandé.' ]; $reqs['allow_url_fopen'] = [ 'status' => ini_get('allow_url_fopen'), 'value' => ini_get('allow_url_fopen') ? 'Activé' : 'Désactivé', 'msg' => 'Requis pour communiquer avec l\'API distante.' ]; $reqs['Permissions Dossier'] = [ 'status' => is_writable(__DIR__), 'value' => is_writable(__DIR__) ? 'Écriture OK' : 'Lecture seule', 'msg' => 'Requis pour créer le fichier cache.json.' ]; return $reqs; } function test_tcp_connection($host, $port) { $start = microtime(true); $fp = @fsockopen($host, $port, $errno, $errstr, 2); $time = round((microtime(true) - $start) * 1000); if (!$fp) { return ['status' => false, 'msg' => "Connexion refusée ({$errstr})", 'time' => '-']; } else { fclose($fp); return ['status' => true, 'msg' => 'Port ouvert et accessible', 'time' => $time . ' ms']; } } function test_endpoint($url, $api_key, $endpoint_name) { $options = [ 'http' => [ 'header' => "x-api-key: {$api_key}\r\n", 'method' => 'GET', 'timeout' => 3, 'ignore_errors' => true ] ]; $context = stream_context_create($options); $start_time = microtime(true); $response = @file_get_contents($url, false, $context); $ping = round((microtime(true) - $start_time) * 1000); $http_code = "Inconnu"; if (isset($http_response_header) && is_array($http_response_header)) { if (preg_match('#HTTP/[0-9\.]+\s+([0-9]+)#', $http_response_header[0], $matches)) { $http_code = intval($matches[1]); } } $html = "
"; $html .= "

➔ /{$endpoint_name}

"; if ($response === false) { $html .= "Échec HTTP (Timeout)
"; $html .= "

Impossible de récupérer les données HTTP.

"; } else { $data = json_decode($response, true); $ts_code = isset($data['status']['code']) ? $data['status']['code'] : 'N/A'; if ($http_code == 200 && $ts_code === 0) { $html .= "HTTP 200 TS Code: 0 (OK)"; } elseif ($ts_code === 5120) { $html .= "HTTP {$http_code} TS Code: 5120 (Out of Scope)"; } elseif ($http_code == 401 || $ts_code === 2568) { $html .= "HTTP {$http_code} TS Code: {$ts_code} (Clé Invalide)"; } else { $html .= "HTTP {$http_code} TS Code: {$ts_code}"; } $html .= "{$ping} ms
"; if ($ts_code === 5120 && $endpoint_name == 'serverinfo') { $html .= "
ℹ️ Note : Erreur 5120 normale si votre clé API est configurée en lecture seule (scope=read).
"; } $pretty_json = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); $html .= "
" . htmlspecialchars($pretty_json) . "
"; } $html .= ""; return $html; } ?> Diagnostic API TS6
⚠️ DANGER : NE LAISSEZ JAMAIS CE FICHIER SUR VOTRE SERVEUR WEB PUBLIC.
Supprimez 'debug.php' de votre hébergement après utilisation.

❌ Fichier config.php introuvable

Veuillez créer votre fichier config.php avant de lancer le diagnostic.

🔍 Diagnostic de l'Environnement

⚙️ Configuration Détectée

Hôte API
Port API
ID Serveur
Clé API

💻 Serveur Web (PHP)

$req): ?>

📡 Réseau & Cache

Ping TCP ()
Fichier Cache
Âge du Cache
Taille du Cache

🔌 Tests de l'API TeamSpeak