How to get response from web-site where is using console application?
It is for windows only.
The main aim is to identify who does php-script run - browser or cron. Therefor开发者_StackOverflow社区e I would like to get print of $_SERVER in console application and understand what is the difference.
May be someone knows how to identify request from cron.
Thanks to all in advance!
I believe you can test $_SERVER['HTTP_HOST']
. If it is not set it's via the CLI, otherwise it's a browser. That is:
if(isset($_SERVER['HTTP_HOST'])) {
echo "Browser!";
} else {
echo "CLI!";
}
精彩评论