Re: How to detect the host (window or Linux)?
| From: | Ashley Sheridan | Date: | Wed, 24 Sep 2008 11:31:50 +0000 |
| Subject: | Re: How to detect the host (window or Linux)? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-280828@lists.php.net to get a copy of this message | ||
On Wed, 2008-09-24 at 19:01 +1000, hce wrote:
> On Mon, Sep 22, 2008 at 4:04 PM, Thodoris <tgol@kinetix.gr> wrote:
> >
> >> $win = stripos(PHP_OS, 'win') !== false ? true : false;
> > Perhaps you could also use this as an alternative:
> >
> > http://gr.php.net/manual/en/function.php-uname.php
>
> Thanks Thodoris and Anderson. Sorry for not clear about the question.
> I mean to detect the OS in Host system where the browser is located,
> not the SERVER OS.
>
For this you can use the get_browser() function of PHP, which returns a
plethora of information as an array. If this function doesn't work (it
didn't for me because of hosting restrictions) then someone called sam
on the php.net manual page has written a function called
php_get_browser() which does the same thing. Just make sure you download
an up-to-date browscap.ini file and you'll have all the information you
want.
Ash
www.ashleysheridan.co.uk