NAME

    WebService::IPAPI - Perl library for using IPAPI, https://ipapi.com.

SYNOPSIS

      use WebService::IPAPI;
    
      my $ipapi = WebService::IPAPI->new(api_key => 'foobar');
      $ipapi->query('8.8.8.8');
    
      # Only for Pro plan.
      $ipapi->query(['8.8.8.8', '8.8.4.4']);

DESCRIPTION

    WebService::IPAPI is Perl library for obtaining information on IPv4 or
    IPv6 address.

DEVELOPMENT

    Source repo at https://github.com/kianmeng/webservice-ipapi.

    How to contribute? Follow through the CONTRIBUTING.md
    <https://github.com/kianmeng/webservice-ipapi/blob/master/CONTRIBUTING.md>
    document to setup your development environment.

METHODS

 new($api_key, $api_plan)

    Construct a new WebService::IPAPI instance.

  api_key

    Compulsory. The API access key used to make request through web
    service.

  api_plan

    Optional. The API subscription plan used when accessing the API. There
    are four subscription plans: free, standard, business, and
    business_pro. By default, the subscription plan is 'free'. The main
    difference between free and non-free subscription plans are HTTPS
    encryption protocol support and additional information.

        # The API request URL is http://api.ipapi.com/api/
        my $ipapi = WebService::IPAPI->new(api_key => 'foo');
        print $ipapi->api_url;
    
        # The API request URL is https://api.ipapi.com/api/
        my $ipapi = WebService::IPAPI->new(api_key => 'foo', api_plan => 'paid');
        print $ipapi->api_url;

  api_url

    The default API hostname and path. The protocol depends on the
    subscription plan.

 lookup($ip_address, [%params])

    Query and get an IP address information. Optionally you can add more
    settings to adjust the output.

        my $ipapi = WebService::IPAPI->new(api_key => 'foobar');
        $ipapi->query('8.8.8.8');
    
        # With optional parameters.
        $ipapi->query('8.8.8.8', {hostname => 1, security => 1, output => 'xml'});

 bulk_lookup($ip_address, [%params])

    Only for Paid subscription plan. Query and get multiple IP addresses
    information. Optionally you can add more settings to adjust the output.

        my $ipapi = WebService::IPAPI->new(api_key => 'foobar', api_plan => 'paid');
        $ipapi->query(['8.8.8.8', '8.8.4.4']);
    
        # With optional parameters.
        $ipapi->query(['8.8.8.8', '8.8.4.4'], {language => 'zh'});

 check([%params])

    Look up the IP address details of the client which made the web service
    call. Optionally you can add more settings to adjust the output.

        my $ipapi = WebService::IPAPI->new(api_key => 'foobar');
        $ipapi->check();
    
        # With optional parameters.
        $ipapi->check({hostname => 1, security => 1, output => xml});

COPYRIGHT AND LICENSE

    This software is Copyright (c) 2019 by Kian Meng, Ang.

    This is free software, licensed under:

        The Artistic License 2.0 (GPL Compatible)

AUTHOR

    Kian Meng, Ang <kianmeng@users.noreply.github.com>