Re: Detect local or remote call?
| From: | Nathan Nobbe | Date: | Thu, 11 Oct 2007 18:10:09 +0000 |
| Subject: | Re: Detect local or remote call? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263112@lists.php.net to get a copy of this message | ||
On 10/11/07, Anders Norrbring <lists@norrbring.se> wrote:
>
> Is there a good way to detect in a script if it's called locally from
> command line, or via a remote browser?
>
> Anders
maybe not the best, but works for linux:
<?php
if(isset($_SERVER['SHELL'])) {
echo 'cli script' . PHP_EOL;
} else {
echo 'web script';
}
?>
-nathan