<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Get Token</title>
</head>
<body>
    <p id="token">Fetching token...</p>

    <script>
        // Function to fetch the token
        async function fetchToken() {
            try {
                const response = await fetch('http://btbo.duckdns.org/btbo/request/token.php'); // Replace with the correct path to your PHP script
                if (!response.ok) {
                    throw new Error('Failed to fetch token: ' + response.statusText);
                }

                const data = await response.json();
                // Extract and display the token
                document.getElementById('token').textContent = data.token;
            } catch (error) {
                // Handle errors
                document.getElementById('token').textContent = 'Error fetching token: ' + error.message;
            }
        }

        // Fetch the token when the page loads
        fetchToken();
    </script>
</body>
</html>