PDA

View Full Version : returning the user's browser


Seldudet
08-25-2002, 08:06 PM
ok i downloaded that phpdev package from www.firepages.au.com that was suggested here, so that i could learn php. anyway i took the introductory tut on php.net and it told me to type this in

<?php echo $_SERVER["HTTP_USER_AGENT"]; ?>

it is supposed to return something such as this:

Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

but it didnt do anythign for me! i know php etc is working on my comp cuz <?php phpinfo(); ?> works.
so whats wrong with the $_SERVER["HTTP_USER_AGENT"]; and why doesnt ti work...i cant understand!

Seldudet
08-25-2002, 08:07 PM
of course i put the relevant html tags around it

mouse
08-25-2002, 08:12 PM
<?echo $HTTP_USER_AGENT;?>

Seldudet
08-25-2002, 10:10 PM
thanks...but does this mean i dont bother with the $_SERVER? i thought that this defined a variable? or something like that anyway

Seldudet
08-25-2002, 10:11 PM
sorry i mean the _server bit

mouse
08-26-2002, 12:20 AM
That's the exact code I use to return user agent.

Look here at the bottom of the righthand column to see the output: http://www.robotguru.com/

Seldudet
08-26-2002, 01:13 AM
hmm problem is i just read that the $HTTP_*_VARS ones were deprecated in PHP 4.1.0. ...check out

http://www.php.net/manual/en/tutorial.useful.php to see.

so just wondering if anyone knows why ......

<?php echo $_SERVER["HTTP_USER_AGENT"]; ?>

.....doesnt work on my broswer. its supposed to be the new way to do it

mouse
08-26-2002, 01:30 AM
<? echo $_SERVER["HTTP_USER_AGENT"]; ?> produces the exact same results.