Get Started With IP2Proxy C Module

Dependencies

This library requires IP2Proxy BIN database to function. You may download the BIN database at

Note

An outdated BIN database was provided in the data folder for your testing. You are recommended to visit the above links to download the latest BIN database.


Installation

This library can be compiled and installed in different platform. Please refer to different section for the respective platform.

Unix/Linux

    autoreconf -i -v --force
    ./configure
    make

							
						

Debian

AMD64

curl -LO https://github.com/ip2location/ip2proxy-c/releases/download/4.2.0/ip2proxy-4.2.0-amd64.deb
sudo dpkg -i ip2proxy-4.2.0-amd64.deb

							
						

ARM64

curl -LO https://github.com/ip2location/ip2proxy-c/releases/download/4.2.0/ip2proxy-4.2.0-arm64.deb
sudo dpkg -i ip2proxy-4.2.0-arm64.deb

							
						

Ubuntu

sudo add-apt-repository ppa:ip2location/ip2proxy
sudo apt update
sudo apt install ip2proxy

							
						

Windows

    Execute "vcvarsall.bat". (This file is part of Microsoft Visual C, not ip2location code)
    nmake -f Makefile.win

							
						

MacOS

    autoreconf -i -v --force
    export CFLAGS=-I/usr/include/malloc
    ./configure
    make

							
						

Sample Codes

Query geolocation information from BIN database

You can query the geolocation information from the IP2Proxy BIN database as below:

#include "IP2Proxy.h"

IP2Proxy *IP2ProxyObj = IP2Proxy_open("../data/SAMPLE.BIN");
IP2ProxyRecord *record = IP2Proxy_get_all(IP2ProxyObj, "161.11.12.13");
printf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
	record->country_short,
	record->country_long,
	record->region,
	record->city,
	record->isp,
	record->is_proxy;
	record->proxy_type,
	record->domain,
	record->usage_type,
	record->asn,
	record->as_,
	record->last_seen,
	record->threat,
	record->provider,
	record->fraud_score);
IP2Proxy_free_record(record);
IP2Proxy_close(IP2ProxyObj);

							
						

IP2Proxy Sample Database (BIN)

Sample Packages - BIN File IPv4 + IPv6
IP2Proxy PX1 Download (391.66 kB)
IP2Proxy PX2 Download (406.53 kB)
IP2Proxy PX3 Download (435.82 kB)
IP2Proxy PX4 Download (471.49 kB)
IP2Proxy PX5 Download (491.37 kB)
IP2Proxy PX6 Download (493.92 kB)
IP2Proxy PX7 Download (534.57 kB)
IP2Proxy PX8 Download (540.70 kB)
IP2Proxy PX9 Download (541.56 kB)
IP2Proxy PX10 Download (677.91 kB)
IP2Proxy PX11 Download (684.40 kB)
IP2Proxy PX12 Download (687.12 kB)