[ "method" => "GET", "header" => "Authorization: Bearer " . CODM_API_KEY . "\r\n" . "Accept: application/json\r\n" . "User-Agent: CODM-Stats-Panel/1.0\r\n" ] ]; $context = stream_context_create($options); // Suppress technical warnings with '@' to prevent exposing server details to users $response = @file_get_contents($url, false, $context); if ($response !== false) { $result_data = json_decode($response, true); // Validate if API successfully found the player structure if (isset($result_data['status']) && $result_data['status'] === 'success' && isset($result_data['data'])) { $player_stats = $result_data['data']; } else if (isset($result_data['data']['message'])) { $error_msg = "API Error: " . htmlspecialchars($result_data['data']['message']); $result_data = null; } else { $error_msg = "Player data format not recognized. Check privacy settings on Activision."; $result_data = null; } } else { $error_msg = "Network Error: Could not connect to API. Verify your API Key configuration."; } } else { $error_msg = "Please input a valid Player ID."; } } ?>