Operating System Detection

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pbritten
Forum Newbie
Posts: 13
Joined: Wed Mar 24, 2004 9:24 am
Location: State College, Pennsylvania, USA

Operating System Detection

Post by pbritten »

Greetings!

Would someone please help me with OS detection. I'm doing some CSS development that breaks in Mac, and need to create a second stylesheet to accomodate the differences.

I've read the manual and searched the forums of this site to no avail.

Thank you for your help with this.

Pat
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You should be able to get some information from

Code: Select all

echo $_SERVER['HTTP_USER_AGENT'];
But that is an optional header and so it wont always be there.

If you:

Code: Select all

echo '<pre>';
print_r($_SERVER);
echo '</pre>';
You should get a pretty good idea of what you can pick up from the HTTP Request ;-)
pbritten
Forum Newbie
Posts: 13
Joined: Wed Mar 24, 2004 9:24 am
Location: State College, Pennsylvania, USA

Post by pbritten »

Thank you for your reply. Unfortunately, the result provided quite a laundry list, but no platform. The User_Agent did list browser types, but I was hoping for something more direct re the user machines platform.

Did I miss something?

Pat
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

a quick google search turned up this

http://techpatterns.com/downloads/php_b ... p#php_full

but i didnt look at it extensivly

p.s. pbritten, if you know allison legheart or ben smith (both goto PSU) say hello to em for me!
pbritten
Forum Newbie
Posts: 13
Joined: Wed Mar 24, 2004 9:24 am
Location: State College, Pennsylvania, USA

Post by pbritten »

Thank you, shiznatix. I never thought of using Google for problems like this; always looked for help in the forums.

You may've opened up some new doors for me.

Much obliged!

Pat
Post Reply