Re: How to detect browsers with $HTTP_USER_AGENT
| From: | Richard Lynch | Date: | Tue, 12 Dec 2000 19:09:33 +0000 |
| Subject: | Re: How to detect browsers with $HTTP_USER_AGENT | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29940@lists.php.net to get a copy of this message | ||
There's a whole browsecap (sp?) thing that people use for that.
See php.ini
You could also roll your own.
See <?php phpinfo();?> and you'll probably find $HTTP_USER_AGENT there.
Then you just use ereg_* or preg_* or whatever you need to do what you want.
There is also sample code in the code archives http://php.net/links.php
Finally, I think php.net itself does this for those cool popup dhtml layers
and whatnot -- since IE/Netscape need different dhtml to not crash. Click
on the source code button and start digging.
----- Original Message -----
From: Carlos Fernando <nando@antunes.eti.br>
Newsgroups: php.general
Sent: Tuesday, December 12, 2000 12:12 PM
Subject: [PHP] How to detect browsers with $HTTP_USER_AGENT
> Hello everybody,
>
> Usually I log my web site activity including the User Agent string that
> is returned by the client's browser. I would like to implement something
> like Netscape but using PHP. I need to create a function to identify
> what comes through the User Agent content and write it back in a
> friendly way :
>
> For instance :
>
> Mozilla/4,0 (compatible; MSIE 5.5; Windows 98) = Internet Explorer 5.5
> OS Windows 98
>
> Mozilla/4.76 [en] (X11; U; Linux2.2.16-22.i586) = Netscape 4.76 under
> Linux
>
> Is there any patterns or rules that aplly to the User Agent variable?
>
> How could I accomplish that?
>
> Thank you,
>
> Carlos Fernando Scheidecker Antunes
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>