<?php
header("Content-Type: text/event-stream");
header("Cache-Control: no-cache");
header("Connection: keep-alive");
while (true) {
 if (file_exists("status.txt")) {
 $data = file_get_contents("status.txt");
 echo "data: $data\n\n";
 } else {
 echo "data: {}\n\n";
 }
 ob_flush();
 flush();
usleep(200000);
}