Current location: Hot Scripts Forums » Programming Languages » Perl » HTTP Vars


HTTP Vars

Reply
  #1 (permalink)  
Old 10-01-03, 05:42 AM
bog bog is offline
New Member
 
Join Date: Oct 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Arrow HTTP Vars

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
Reply With Quote
  #2 (permalink)  
Old 10-02-03, 10:37 AM
Chas Chas is offline
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
Hi bog,

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

Code:
#!/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
Reply With Quote
  #3 (permalink)  
Old 10-04-03, 09:52 PM
rob2132 rob2132 is offline
Newbie Coder
 
Join Date: Sep 2003
Location: USA
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by bog
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.
Reply With Quote
  #4 (permalink)  
Old 10-07-03, 11:03 AM
bog bog is offline
New Member
 
Join Date: Oct 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
hi
for the moment Chas' answer satisfied me I just wanted the hashe's name
thanks
__________________
_-o0O°BOG°O0o-_
Reply With Quote
  #5 (permalink)  
Old 10-07-03, 01:32 PM
rob2132 rob2132 is offline
Newbie Coder
 
Join Date: Sep 2003
Location: USA
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by bog
hi
for the moment Chas' answer satisfied me I just wanted the hashe's name
thanks
Ah, good deal. :-)
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP Authentication SleeperZ PHP 2 08-06-03 05:27 AM
how to get info from TXT file between %%customTags%% as vars?? paulj000 PHP 2 07-26-03 05:00 AM
get vars from local file into textareas paulj000 PHP 5 07-15-03 01:02 AM


All times are GMT -5. The time now is 04:08 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.