NAME
WWW::jsonip - Get a JSON format ip info through http://jsonip.cn
VERSION
version 0.001
SYNOPSIS
use WWW::jsonip qw/json_ip/;
my $ip = json_ip(); # {"ip": "123.45.67.89", "detail":"http://jsonip.cn/i"}
EXPORTS
Exports the json_ip
and ip_detail
functions.
FUNCTIONS
json_ip
Get a JSON format ip info:
use WWW::jsonip qw/json_ip/;
use JSON;
use Data::Dumper;
my $ip_info = json_ip();
$ip_info = form_json($ip_info);
print Dumper $ip_info
# {"ip": "123.45.67.89", "detail":"http://jsonip.cn/i"};
ip_detail
Get a JSON format ip info in a little detail, including OS/Browser/Geo etc.
use WWW::jsonip qw/ip_detail/;
use JSON;
use Data::Dumper;
my $ip_detail = ip_detail();
$ip_detail = form_json($ip_detail);
print Dumper $ip_detail;
# {
# ip: "123.45.67.89",
# browser: "Chrome",
# os: "Macintosh",
# country: "中国",
# city: "北京"
# }
AUTHOR
Bin Joy <perlxruby@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Bin Joy.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.