Entry
How do I get information from the user like browser version, ip, connection speed, plug-ins, etc?
Dec 4th, 2002 19:08
Ryan Buterbaugh, Felix Valdez,
You can get some of that information from environmental variables (the
associative array %ENV contains these). Other information can be
obtained in other ways. You can create a bandwidth tester, and some
javascript will test for plugins. If you want to see all of the
environmental variables, create something like this:
--START FILE TEST.PL--
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "<html>\n";
foreach $key (keys(%ENV)) {
print "$key = $ENV{$key}<br>\n";
}
print "</html>\n";
--END FILE TEST.PL--
that file, when put on a web server, will print out all the
environmental variables available. there are also a few additional
ones that may not print, depending on server conditions. if it is a
secure server $ENV{'HTTPS'} will be "on". you can also get .htaccess
information with $ENV{'REMOTE_USER'}.