I have two pages redirection in my index.php. The pages are example_system_os.php
and example_mobile_os.php
.
How to determine the user\'s o
The get_browser function can be used to extract a couple of information the User-Agent
HTTP header sent by the browser.
Amongst those informations, it seems there is some data about the operating system the browser's running on -- i.e. about the client OS.
Quoting the example given on the manual page of get_browser
:
Array
(
[browser_name_regex] => ^mozilla/5\.0 (windows; .; windows nt 5\.1; .*rv:.*) gecko/.* firefox/0\.9.*$
[browser_name_pattern] => Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:*) Gecko/* Firefox/0.9*
[parent] => Firefox 0.9
[platform] => WinXP
[browser] => Firefox
[version] => 0.9
But note that the User-Agent HTTP header is sent by the client, which means :
You could parse the $_SERVER['HTTP_USER_AGENT']
string for the various platform details, but I wouldn't be confident that this was a deterministic approach, since it can easily be faked.