I have a script that is designed to be run both as a web page, and via the console.
Detecting which method was used to invoke the script seems pretty straight forwar
For Windows, you can use this:
$b = stream_isatty(STDIN); if ($b) { echo "php script.php\n"; } else { echo "php script.php < input_file\n"; }
https://php.net/function.stream-isatty