'Forbidden', 'host' => $host, 'referer' => $referer]); exit; } // $_SERVER is more reliable than getenv() under Apache/mod_php $key = $_SERVER['GMAPS_API_KEY'] ?? $_ENV['GMAPS_API_KEY'] ?? getenv('GMAPS_API_KEY') ?: ''; if (!$key) { http_response_code(503); header('Content-Type: application/json'); echo json_encode(['error' => 'Key not configured']); exit; } header('Content-Type: application/json'); header('Cache-Control: no-store, no-cache, must-revalidate'); echo json_encode(['key' => $key]);