You are here: Re: Script running under Command Prompt or Browser or some other application? « PHP Programming Language « IT news, forums, messages
Re: Script running under Command Prompt or Browser or some other application?

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация