pricing background

C++ API Integration

api

Geolocation Lookup

#include <curl/curl.h>
#include <stdio.h>

int main() {
	CURL *curl = curl_easy_init();
	if(curl) {
		curl_easy_setopt(curl, CURLOPT_URL, "https://api.whoisfreaks.com/v1.0/geolocation?apiKey=API_KEY&ip=8.8.8.8");
		curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
		curl_easy_perform(curl);
		curl_easy_cleanup(curl);
	}
	return 0;
}

Bulk Geolocation Lookup

#include <curl/curl.h>
#include <stdio.h>

int main() {
	CURL *curl = curl_easy_init();
	if(curl) {
		curl_easy_setopt(curl, CURLOPT_URL, "https://api.whoisfreaks.com/v1.0/geolocation?apiKey=API_KEY");
		curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
		struct curl_slist *headers = NULL;
		headers = curl_slist_append(headers, "Content-Type: application/json");
		curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
		curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{"ips":["1.1.1.1","2.2.2.2","8.8.8.8"]}");
		curl_easy_perform(curl);
		curl_easy_cleanup(curl);
	}
	return 0;
}