PDA

View Full Version : HTTP Vars


bog
10-01-03, 06:42 AM
hi there
I wanna say for every one hello it is my first post

I have a great problem : if any one could help me plz plz

how could I retrieve the HTTP Environment Vars like :
GATEWAY_INTERFACE
HTTPS
HTTP_ACCEPT
HTTP_ACCEPT_ENCODING
GATEWAY_INTERFACE
HTTPS,HTTP_ACCEPT
HTTP_ACCEPT_ENCODING
HTTP_ACCEPT_LANGUAGE
HTTP_CONNECTION
HTTP_HOST
HTTP_REFERER ...and so on

Thankssss

Chas
10-02-03, 11:37 AM
Hi bog,

You can access these vars using the %ENV hash. Here is a quick example that will print all the vars:


#!/usr/bin/perl -w
use strict;

print "Content-Type: Text/HTML\n\n";
print '<pre>';
foreach my $env (keys %ENV) {
print "$env -> $ENV{$env}\n";
}
print '</pre>';


To access a specific var, you would use something like this: $ENV{'HTTP_HOST'}

~Charlie
:wq

rob2132
10-04-03, 10:52 PM
hi there
I wanna say for every one hello it is my first post

I have a great problem : if any one could help me plz plz

how could I retrieve the HTTP Environment Vars like :
GATEWAY_INTERFACE
HTTPS
HTTP_ACCEPT
HTTP_ACCEPT_ENCODING
GATEWAY_INTERFACE
HTTPS,HTTP_ACCEPT
HTTP_ACCEPT_ENCODING
HTTP_ACCEPT_LANGUAGE
HTTP_CONNECTION
HTTP_HOST
HTTP_REFERER ...and so on

Thankssss


Are you looking to use/display them, know what one's are out there to use/check/display, or just the entire %ENV displayed--as the poster above offered the answer to? If not, please be more specific and I'm sure one of us would be happy to offer the answer(s)--assuming the above poster didn't cover your question. (I just may be confused). Cheers.

bog
10-07-03, 12:03 PM
hi
for the moment Chas' answer satisfied me I just wanted the hashe's name
thanks

rob2132
10-07-03, 02:32 PM
hi
for the moment Chas' answer satisfied me I just wanted the hashe's name
thanks

Ah, good deal. :-)