Re: Send out different content depends on User Agent String



Allerdyce.John@xxxxxxxxx wrote:
>
> Is there an easy way in PHP which send outs different content
> depends on User Agent String value?

Yes. There is a superglobal variable $_SERVER['HTTP_USER_AGENT']

> If yes, is there an example/documentation?

Here is the documentation on the subject in its entirety:

'HTTP_USER_AGENT'
Contents of the User-Agent: header from the current request,
if there is one. This is a string denoting the user agent being
which is accessing the page. A typical example is: Mozilla/4.5
[en] (X11; U; Linux 2.2.9 i586). Among other things, you can
use this value with get_browser() to tailor your page's output
to the capabilities of the user agent.

Source:
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server

Cheers,
NC

.



Relevant Pages

  • Re: TurboTax.com (Here we go again...)
    ... is a User Agent string on an XP system with FireFox 3.0.5. ... set the alternate useragent header without installing a plugin. ... We just installed the windows version of Firefox ...
    (Fedora)
  • Re: Netsurf and User Agent faking
    ... NetSurf doesn't currently do this. ... the user agent string can only be changed at compile ... In some ways I would like not to use faking, ...
    (comp.sys.acorn.apps)
  • Re: TurboTax.com (Here we go again...)
    ... is a User Agent string on an XP system with FireFox 3.0.5. ... simply add this to User Agent Switcher. ... set the alternate useragent header without installing a plugin. ...
    (Fedora)
  • Re: Impersonate Login Page
    ... web site with what a web browser sends. ... than one site that checks the user agent string. ... recognize the user agent they'd simply return a 404 or a 500 code. ... IE request with the UserAgent property on HttpWebRequest. ...
    (microsoft.public.dotnet.framework.aspnet)
  • How to change User Agent string frequently?
    ... to set the User Agent string and it works. ... WebBrowser control to embed a little webbrowser functionality in my ... Can I anyhow change the user agent string multiple times? ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)