|
Posted by NC on 11/28/07 05:51
On Nov 27, 9:34 pm, Ojas <contacto...@gmail.com> wrote:
>
> I just out of curiosity want to know how top detect
> the client side application under which the script
> is getting run. I mean to ask the how to know whether
> the script is running under Command Prompt or Browser
> or some other application?
This is not exactly possible. What is possible is knowing which PHP
interpreter (server module, CGI, command line, etc.) is processing the
current script:
http://www.php.net/manual/en/function.php-sapi-name.php
As to the client-side application requesting the script, the client is
under no obligation to identify itself. If it does identify itself
(by sending a "User-Agent:" request header), data sent in that header
are made available to the script as $_SERVER["HTTP_USER_AGENT"].
Cheers,
NC
[Back to original message]
|