<?php

function getGeneratedImage() {
    // $command = "bash resources/readOut.sh";
    // $escaped_command = escapeshellcmd($command);
    // $myfile = fopen("resources/image", "r+") or die("Unable to open file!");
    // $string fread($myfile,1);
    // fclose($myfile);
    // return $string;
    // return exec($escaped_command);
    $stdin = fopen('php://stdin', 'r');
    $line = trim(fgets($stdin)); // reads one line from STDIN
    echo $line;
}


if (isset($_POST["getStream"])) {
   if ($_POST["getStream"] == true) {
       echo getGeneratedImage();
   }
}


?>
