Run gravity.sh from the web UI

This commit is contained in:
DL6ER
2016-11-18 13:43:05 +01:00
parent d3fce57e58
commit 66e4da7724
4 changed files with 92 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
<?php
ob_end_flush();
ini_set("output_buffering", "0");
ob_implicit_flush(true);
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
function echoEvent($datatext) {
echo "data: ".implode("\ndata: ", explode("\n", $datatext))."\n\n";
}
echoEvent("START");
$proc = popen("sudo pihole -g", 'r');
while (!feof($proc)) {
echoEvent(fread($proc, 4096));
}
echoEvent("SUCCESS");