browser information using php?

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
shadow_blade47
Forum Newbie
Posts: 12
Joined: Fri Nov 07, 2003 3:41 am

browser information using php?

Post by shadow_blade47 »

hello there!
How would I get the name of a users browser using php? I'm presuming it's possible. I basicly want to get the users ip address, hostname and browser. I can get the ip/hostname and get the info to store in the databse but how would i get the browser? Also it'd be quite handy if it were possible for me to determine the operating system if thats possible? i'm not sure if it is...

Thank you
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

I'm not 100% sure about this but run a script with this:

Code: Select all

<?php
print_r($_SERVER);
?>
You'll get the array of what you can get from the client side.

Hope it helps,

-Nay
shadow_blade47
Forum Newbie
Posts: 12
Joined: Fri Nov 07, 2003 3:41 am

browser

Post by shadow_blade47 »

hmm, tried it, but i need something along the lines of $_SERVER['REMOTE_ADDR'] shame $_SERVER['REMOTE_BROWSER'] Dont work :( but thanks anyway...
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

[php_man]get_browser()[/php_man]

Code: Select all

<?php
$var = get_browser()->browser;
?>
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

LiLpunkSkateR wrote:[php_man]get_browser()[/php_man]

Code: Select all

<?php
$var = get_browser()->browser;
?>
Just a side note: this syntax isn't allowed in PHP4 since it doesn't dereference returned value. If you use PHP4, you need the intermediate variable:

Code: Select all

$var=get_browser();
  $var=$var->browser;
Post Reply