These days it has become increasingly difficult to create a secure environment for your business and clients. Due to its commonality across devices, an IP address has become a prime target for network infiltration/infection. The following API can be used in C/C++ to not only identify known threat IPs, bots, and Tor exit nodes, but also extract location information.
Our first step is to run this command to install libcurl in your project:
After the installation, we’re ready to call the validation function:
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.cloudmersive.com/validate/ip/intelligence");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Apikey: YOUR-API-KEY-HERE");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "\"<string>\"";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
With the help of this tool, you will know if the IP address is safe to interact with, as well as useful demographic information such as city, country, currency, and more!