Geo::SypexGeo - API to detect cities by IP thru Sypex Geo database v.2
use Geo::SypexGeo; my $geo = Geo::SypexGeo->new( './SxGeoCity.dat' ); # Method parse return Geo::SypexGeo::Info object $info = $geo->parse( '220.127.116.11', 'en' ) or die "Cant parse 18.104.22.168"; say $info->city(); $info = $geo->parse('22.214.171.124') or die "Cant parse 126.96.36.199"; say $info->city(); say $info->country(); my ( $latitude, $longitude ) = $info->coordinates(); say "Latitude: $latitude Longitude: $longitude"; ## deprecated method (will be removed in future versions) say $geo->get_city( '188.8.131.52', 'en' ); ## deprecated method (will be removed in future versions) say $geo->get_city('184.108.40.206'); ## deprecated method (will be removed in future versions) say $geo->get_country('220.127.116.11');
Sypex Geo is a database to detect cities by IP.
The database of IPs is included into distribution, but it is better to download latest version at download page.
The database is availible with a names of the cities in Russian and English languages.
This module now is detect only city name and don't use any features to speed up of detection. In the future I plan to add more functionality.
The source code for this module is available from Github at https://github.com/kak-tus/Geo-SypexGeo
Andrey Kuzmin, <firstname.lastname@example.org>
Copyright (C) 2014 by Andrey Kuzmin
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.