开发者

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!";
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜