Webcam Script PhP

<?php
$image_url = "https://ravensburg-webcam.de/snapshot.jpg";
$headers = @get_headers($image_url);
$cam_online = $headers && strpos($headers[0], "200 OK") !== false;
$timestamp = date("d.m.Y H:i:s");
?>
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <title>Webcam Live-Status</title>
    <style>
        body {
            font-family: 'Segoe UI', sans-serif;
            background: #ffffff;
            color: #fff;
            text-align: center;
            padding: 30px;
        }
        h1 {
            margin-bottom: 10px;
        }
        .status {
            display: inline-block;
            padding: 10px 20px;
            border-radius: 30px;
            font-weight: bold;
            margin-bottom: 20px;
            font-size: 18px;
        }
        .online {
            background-color: #28a745;
            color: #fff;
        }
        .offline {
            background-color: #dc3545;
            color: #fff;
        }
        .timestamp {
            font-size: 14px;
            color: #ccc;
            margin-bottom: 20px;
        }
        .frame {
            display: inline-block;
            border: 5px solid #00bfff;
            border-radius: 12px;
            box-shadow: 0 0 15px rgba(0, 191, 255, 0.4);
            padding: 10px;
            background: #2c2c3c;
        }
        img {
            width: 600px;
            height: 320px;
            border-radius: 8px;
        }
        p {
            font-size: 16px;
        }
    </style>
</head>
<body>
    <h1>🔍 Webcam Status</h1>
    <div class="status <?= $cam_online ? 'online' : 'offline' ?>">
        <?= $cam_online ? '🟢 Kamera ist ONLINE' : '🔴 Kamera ist OFFLINE' ?>
    </div>
    <div class="timestamp">Letztes Update: <?= $timestamp ?></div>

    <?php if ($cam_online): ?>
        <div class="frame">
            <img src="<?= $image_url ?>?t=<?= time() ?>" alt="Livebild">
        </div>
    <?php else: ?>
        <p>⚠️ Das Livebild ist momentan nicht verfügbar.</p>
    <?php endif; ?>
</body>
</html>