[Operating System Name with php] - Computers



Search Tech-Forums - link takes you to our Forum's search page.

Note: The following is only a text archive!


To view the actual forum discussion, please visit our website at http://www.tech-forums.net

Pages:1



Operating System Name with php

(Click here to view the original thread with full colors/images)



Posted by: real_in

Hello guys,

can you please help me extracting OS name of a user visiting a page scripted in php ?

I found a function called PHP_UNAME() is this fine, i mean does it work all the time,

also the problem with this function is that it displays my computer name also .. and for windows XP it shows WINNT 5.1 BUILD 2660

how can i get the exact names of all OS like if the person is visiting from other OS then ??


for me here is the output of <?php php_uname() ?>

[B]Windows NT REALIN-7F1A38EB 5.1 build 2600 [/B]


^^ this is on WINDOWS XP with SP2


thanks a lot :)



Posted by: ryno

What php_uname does is return the operating system that php is currently running on (the server). What it looks like you want is the operating system of the client. That's also pretty easy to get.

The environmental variable $_SERVER['HTTP_USER_AGENT'] contains the information you are looking for. It will return a string which will look like the following.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0

This means the client is running Firefox 2.0 on Windows XP.

Below is a link to the Wikipedia article on user agents. It contains a list of user agents and what browser and OS they are associated with.
[url]http://en.wikipedia.org/wiki/User_agent[/url]



Posted by: real_in

thanks a lot mate, this info gonna help a lot .. :)





vBulletin Copyright ©2000 - 2003, Jelsoft Enterprises Limited.


PPC Management
vB Easy Archive Final - Created by Xenon