六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 18|回复: 0

Getting Browsers Information from HEADER

[复制链接]

升级  34.8%

548

主题

548

主题

548

主题

探花

Rank: 6Rank: 6

积分
1696
 楼主| 发表于 2013-2-7 17:12:28 | 显示全部楼层 |阅读模式
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,
};
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表