|
Posted by Sune Storgaard on 01/27/06 08:13
Allerdyce.John@gmail.com wrote:
> Hi,
>
> Is there an easy way in PHP which send outs different content depends
> on User Agent String value?
> If yes, is there an example/documentation?
Im not sure what exactly you want to achieve, but this reserved variable
will contain the useragent string (which can be forged easely)
$_SERVER['HTTP_USER_AGENT']
It will return something like this:
"Mozilla/5.0 (Windows; U; Windows NT 5.1; da; rv:1.8) Gecko/20051111
Firefox/1.5"Use some str function to check for occurences of "mozilla" and
do some conditional code based on result ?A little untested
example:<?php$ouragent = $_SERVER['HTTP_USER_AGENT']; // could be fitted
into the IF sentence if (substr_count($ouragent,"Mozilla")!=0) {
echo "Mozilla..maybe";}else{ echo "some other stuff"}?>
Navigation:
[Reply to this message]
|