You are here: Re: Send out different content depends on User Agent String « PHP Programming Language « IT news, forums, messages
Re: Send out different content depends on User Agent String

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]


Удаленная работа для программистов  •  Как заработать на 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

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