['timeout' => 2] ]); $raw = @file_get_contents($url, false, $ctx); if ($raw === false) { return null; } $data = json_decode($raw, true); return is_array($data) ? $data : null; } # ---------- Load data ---------- $api_url = "$api_host:$api_port$api_path"; $payload = fetch_json($api_url); # ---------- Render ---------- ?>
⚠️ Could not fetch data from the API.
| Device | Comment | Temp (°C) | Humidity % |
|---|---|---|---|
| = htmlspecialchars($s['name']) ?> | = htmlspecialchars($s['comment'] ?? '') ?> | = htmlspecialchars($temp) ?> | = htmlspecialchars($hum) ?> |