Page 1 of 1

browser information using php?

Posted: Sat Nov 08, 2003 8:38 am
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

Posted: Sat Nov 08, 2003 8:43 am
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

browser

Posted: Sat Nov 08, 2003 8:49 am
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...

Posted: Sat Nov 08, 2003 9:09 am
by d3ad1ysp0rk
[php_man]get_browser()[/php_man]

Code: Select all

<?php
$var = get_browser()->browser;
?>

Posted: Sat Nov 08, 2003 11:25 am
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;