Connecting Tech Pros Worldwide Forums | Help | Site Map

HTTP variables

dave
Guest
 
Posts: n/a
#1: Jul 17 '05
Hello,
I've got an issue with php4 that i suspect has to do with
register_globals being off. I want to access the HTTP_* variables exported
by apache. I would normally do this via:
echo "$HTTP_USER_AGENT";
with register_globals off this isn't working. This request isn't part of a
form so the $_GET and $_POST arrays won't have it. According to phpinfo()
the variable is being set i am unable to find it. Any help appreciated.
Thanks.
Dave.



Steve
Guest
 
Posts: n/a
#2: Jul 17 '05

re: HTTP variables



Must be my turn for the obligatory daily RTFM request...

RTFM:

http://www.php.net/reserved.variables

Use...

print $_SERVER['HTTP_USER_AGENT'];

or for older PHPs...

global $HTTP_SERVER_VARS;
print $HTTP_SERVER_VARS['HTTP_USER_AGENT'];

---
Steve

Nikolai Chuvakhin
Guest
 
Posts: n/a
#3: Jul 17 '05

re: HTTP variables


"dave" <dmehler26@woh.rr.com> wrote in message
news:<E7C3d.23456$_z4.7331@fe1.columbus.rr.com>...[color=blue]
>
> I've got an issue with php4 that i suspect has to do with
> register_globals being off. I want to access the HTTP_* variables
> exported by apache. I would normally do this via:
> echo "$HTTP_USER_AGENT";
> with register_globals off this isn't working. This request isn't part of a
> form so the $_GET and $_POST arrays won't have it.[/color]

Sure, but the $_SERVER will... Try $_SERVER['HTTP_USER_AGENT'].

Cheers,
NC
Closed Thread