Blog

All Blog Posts  |  Next Post  |  Previous Post

Discover the Abstract IP Geolocation API with FNC

Bookmarks: 

Wednesday, October 06, 2021

Intro

You would be amazed to find out how much detailed and accurate information you can retrieve from an IP address. Collecting data based on the IP address can be key to various parts of your business. Want to know where your customers are located during an online meeting? Want to include this technology in your application to gather statistical data and don't know exactly how to get started? The TTMSFNCCloudIPLocalization component (part of the TMS FNC Cloud Pack) is designed to retrieve detailed and accurate information from an IP address and is capable of doing this via the IP Geolocation API from Abstract.


TMS Software Delphi  Components


The TTMSFNCCloudIPLocalization component is able to retrieve the following information from an IP address.

  • Country name, code & flag image
  • Region name & code
  • Virtual Private Network (VPN) detection
  • Internet Service Provider (ISP) information
  • Latitude & Longitude
  • Timezone information


Getting Started

The code snippets below are based on the IP Geolocation API from Abstract to retrieve the information we want to visualize. To get started, you will need to create a free account. After logging in, go to dashboard, select IP Geolocation. The process only takes a couple of seconds, afterwards you can copy the API key which is required to work with the TTMSFNCIPLocalization component. Below you can see the page you get after setting up your account.

TMS Software Delphi  Components


The above steps is all we need to do get started with the TTMSFNCIPLocalization component. Drop an instance of TTMSFNCIPLocalization on the form. Set the API key and set the service property. (Replace 'MyAPIKey' with a valid API key).

TMSFNCCloudIPLocalization1.APIKey := 'MyAPIKey';
TMSFNCCloudIPLocalization1.Service := ipsAbstractAPI;
TMSFNCCloudIPLocalization1.OnGetIP := DoGetIP;

After assigning the OnGetIP event, add a button with the following code to retrieve your own IP address.

TMSFNCCloudIPLocalization1.GetIP;

Alternatively, you can also add a custom IP address. This can be done with the following code. (Replace 'x.x.x.x' with a valid IP address)

TMSFNCCloudIPLocalization1.GetIP('x.x.x.x');

After clicking the button, calling the GetIP procedure, the OnGetIP event will be triggered. In this event, we have immediate access to the information retreive from the IP address. Backtracing which IP address was requested can be done via AIP.IPAddress

procedure TGetIPDataForm.DoGetIP(Sender: TObject; AIP: TTMSFNCCloudIPLocalizationIP; AError: Boolean; 
const ARequestResult: TTMSFNCCloudBaseRequestResult);
begin
  //retrieve IP address information via the AIP parameter
end;

Below is an overview of the properties that are available when using the AIP parameter after the request has finished executing.

TMS Software Delphi  Components


Demo

Included in the distribution is a demo, which shows the capabilities of the TTMSFNCCloudIPLocalization component. Below is a screenshot of the demo in action. Note that the IP address and coordinates have been blurred for privacy reasons.

TMS Software Delphi  Components


Additional Services

The blog post focuses on the IP Geolocation API from Abstract, but the TTMSFNCCloudIPLocalization component is also capable of connecting to the following additional services. The account creation and API retrieval process is different for each service, but the way the component operates remains identical. To select one of the other services, set the Service property to either ipsIPData or ipsIPStack and set the API key for that specific service.


TMS Software Delphi  Components

IPData

TMS Software Delphi  Components

IPStack


Available Today!

The TTMSFNCCloudIPLocalization component is available in the latest update, available today. So go ahead and download the latest version of the TMS FNC Cloud Pack. The TMS FNC Cloud Pack is part of the FNC family, so as a reminder, below is an overview of what FNC has to offer.


TMS FNC Components can be used simultaneously on these frameworks


TMS FNC Components can be used simultaneously on these operating systems/browsers


TMS FNC Controls can be used simultaneously on these IDEs



Pieter Scheldeman


Bookmarks: 

This blog post has received 1 comment.


1. Thursday, October 07, 2021 at 6:50:12 PM

This is pretty unreliable, at least on PC browsers.
I''m subscribed to O2 and for each nightly DSL-reconnect it assigns a very different IP-Adr, its location is distributed all over Germany not even near my location. So a perfect feature for my privacy protection. I like that very much.
For the same reason the PC-browser builtin geolocation function fails as well. On mobiles that works differently and is precise.

Bartels Jürgen




Add a new comment:
Author:
Email:
  You will receive a confirmation mail with a link to validate your comment, so please use a valid email address.
 
Comment:
 
 

All fields are required.
 



All Blog Posts  |  Next Post  |  Previous Post