`
sillycat
  • 浏览: 2488902 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Getting Browsers Information from HEADER

    博客分类:
  • UI
阅读更多
Getting Browsers Information from HEADER

I use perl and CGI to get the HEADER informations.

I use perl template to show the HTML files.

I use PurePerl to show the IP Informations.

perl file Action.pl:
use CGI;
use Template;
use Geo::IP::PurePerl;

my $gi = Geo::IP::PurePerl->open("/usr/local/share/GeoIP/GeoIP.dat", GEOIP_STANDARD);
my $clientIp = $ENV{REMOTE_ADDR};

my $q = CGI->new;
my $actionName = $q->param('actionName');
$h = $q->header();

my $str = "";
while (my ($key,$value)=each %ENV){
  $str = $str . " $key===>$value\n";
}

my $vars = {
    clientIp => $clientIp,
    countryCode => $countryCode,
    countryName => $countryName,
    records => $record_str,
    ispName => $ispName,
    remoteHost => $ENV{REMOTE_HOST},
    remotePort => $ENV{REMOTE_PORT},
    remoteUser => $ENV{REMOTE_USER},
    callingPage => $ENV{HTTP_REFERER},
    requestMethod => $ENV{REQUEST_METHOD},
    hostServerAddress => $ENV{HTTP_HOST},
    requestURI => $ENV{REQUEST_URI},
userAgent => $ENV{HTTP_USER_AGENT},
httpAccept => $ENV{HTTP_ACCEPT},
httpAcceptCharset => $ENV{HTTP_ACCEPT_CHARSET},
httpAcceptEncoding => $ENV{HTTP_ACCEPT_ENCODING},
httpAcceptLanguage => $ENV{HTTP_ACCEPT_LANGUAGE},
httpCookie => $ENV{HTTP_COOKIE},
contentType => $ENV{CONTENT_TYPE},
contentLength => $ENV{CONTENT_LENGTH},
header => $h,
actionName => $actionName,
str => $str,
};

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics