GB IP to Nation

Get geo information about your site visitors by their IPs.

MUST HAVE a valid api key from RapidAPI: IP Geo Location. After subscription, go to My Apps > {YOUR_APPLICATION} > Security. Please also check the limit around rate/request.

I’m currently supporting this API because they answered my email the fastest. Please let me know if you have any other APIs that you’d like to tap into and I’ll consider adding support to it.

Installation

Upload gb_ip_to_nation to the respective system/user/addons/ directory and click install on the Add-Ons page.

Usage

Global Variables

In templates, you will unlock the following geo information tags: - {gb_ip_to_nation:country} - {gb_ip_to_nation:country_code} - {gb_ip_to_nation:flag} - {gb_ip_to_nation:phone_code} - {gb_ip_to_nation:currency} - {gb_ip_to_nation:currency_code} - {gb_ip_to_nation:timezone} - {gb_ip_to_nation:timezone_code} - {gb_ip_to_nation:is_daylight_saving} (bool)

{if gb_ip_to_nation:country == 'Canada'}
    Awesome!
{/if}

<img src="{gb_ip_to_nation:flag}" alt="National flag of: {gb_ip_to_nation:country}"/>

get_ip_info

You can also get information about a specific IP, like

{exp:gb_ip_to_nation:get_ip_info ip="IP_GOES_HERE" prefix="gb_ip"}
    The national flag of {gb_ip:country} is {gb_ip:flag}, and the currency is {gb_ip:currency_code}.
{/exp:gb_ip_to_nation:get_ip_info}

If the IP information is not found, an error message will be displayed.

IMPORTANT if you only have the free basic plan, this will not work because of the rate limit (one request per second).

For developers

You can use the service like this in your own add-on

$ipService = ee('gb_ip_to_nation:IP2Nation');
if ($ipService->initialize()) {
    $info = $ipService->get(IP_GOES_HERE);
}

Settings

API Key

You must have a working API key for this add-on to work.

Cache Mode

To not go over the request limit, we cache the retrieved info. The default is to utilize the EE Cache class ($scope will be global) but you can also save to the Database.

Notes

If you have a proxied server, you might need to make some modifications to affect ee()->input->ip_address because that’s what I’m currently using to fetch the user IP.

cURL must be enabled.

Changelog

1.0.0

  • Hello World!

Support

Email Gilbert at gilbert.lin.web@gmail.com

License

Updated: February 6th, 2021

PERMITTED USE

ONE LICENSE GRANTS THE RIGHT TO PERFORM ONE INSTALLATION OF THE SOFTWARE. EACH ADDITIONAL INSTALLATION OF THE SOFTWARE REQUIRES AN ADDITIONAL PURCHASED LICENSE. FOR FREE SOFTWARE, NO PURCHASE IS NECESSARY, BUT THIS LICENSE STILL APPLIES.

RESTRICTIONS

UNLESS YOU HAVE BEEN GRANTED PRIOR, WRITTEN CONSENT FROM GILBERT LIN, YOU MAY NOT:

  • REPRODUCE, DISTRIBUTE, OR TRANSFER THE SOFTWARE, OR PORTIONS THEREOF, TO ANY THIRD PARTY.
  • SELL, RENT, LEASE, ASSIGN, OR SUBLET THE SOFTWARE OR PORTIONS THEREOF.
  • GRANT RIGHTS TO ANY OTHER PERSON.
  • USE THE SOFTWARE IN VIOLATION OF ANY CANADA OR INTERNATIONAL LAW OR REGULATION.

DISPLAY OF COPYRIGHT NOTICES

ALL COPYRIGHT AND PROPRIETARY NOTICES AND LOGOS IN THE CONTROL PANEL AND WITHIN THE SOFTWARE FILES MUST REMAIN INTACT.

SOFTWARE MODIFICATION

YOU MAY ALTER, MODIFY, OR EXTEND THE SOFTWARE FOR YOUR OWN USE, OR COMMISSION A THIRD-PARTY TO PERFORM MODIFICATIONS FOR YOU, BUT YOU MAY NOT RESELL, REDISTRIBUTE OR TRANSFER THE MODIFIED OR DERIVATIVE VERSION WITHOUT PRIOR WRITTEN CONSENT FROM GILBERT LIN. THE MODIFICATIONS BY YOU OR THE COMMISSIONED THIRD-PARTY MAY NOT INFRINGE AND/OR VIOLATE GILBERT LIN’S LICENSE RIGHTS. COMPONENTS FROM THE SOFTWARE MAY NOT BE EXTRACTED AND USED IN OTHER PROGRAMS WITHOUT PRIOR WRITTEN CONSENT FROM GILBERT LIN.

DISCLAIMER OF WARRANTY

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF QUALITY, PERFORMANCE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. FURTHER, GILBERT LIN DOES NOT WARRANT THAT THE SOFTWARE OR ANY RELATED SERVICE WILL ALWAYS BE AVAILABLE.

LIMITATIONS OF LIABILITY

YOU ASSUME ALL RISK ASSOCIATED WITH THE INSTALLATION AND USE OF THE SOFTWARE. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS OF THE SOFTWARE BE LIABLE FOR CLAIMS, DAMAGES OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE. LICENSE HOLDERS ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USE AND ASSUME ALL RISKS ASSOCIATED WITH ITS USE, INCLUDING BUT NOT LIMITED TO THE RISKS OF PROGRAM ERRORS, DAMAGE TO EQUIPMENT, LOSS OF DATA OR SOFTWARE PROGRAMS, OR UNAVAILABILITY OR INTERRUPTION OF OPERATIONS.

LinkedIn pictogram Instagram pictogram