SDKs overview

IP2Proxy offers a suite of Software Development Kits (SDKs) and libraries designed to facilitate the integration of its IP intelligence services into various applications and platforms. These tools enable developers to programmatically query IP addresses against IP2Proxy's databases or web service to identify proxy types, VPN usage, anonymizers, and other related IP details. The SDKs abstract the underlying data access or API communication, providing language-specific methods and objects for interacting with the IP2Proxy service.

The available SDKs support a range of popular programming languages, allowing developers to choose the most suitable option for their project stack. Beyond official SDKs, community-contributed libraries and examples may also exist, further extending the reach and flexibility of IP2Proxy's offerings. The primary goal of these SDKs is to reduce development time and effort by providing ready-to-use components for common integration patterns, such as checking an IP address against a local database file or making a remote API call to the IP2Proxy Web Service.

Developers can find detailed information, installation instructions, and code samples for each SDK on the IP2Proxy developer documentation portal, which covers both database-based and web service integration methods. Many SDKs are designed to work with Protocol Buffers data structures for efficient data handling.

Official SDKs by language

IP2Proxy provides official SDKs for a variety of programming languages, allowing developers to integrate IP proxy detection capabilities directly into their applications. These SDKs are maintained by IP2Proxy and typically offer direct access to either the local database files or the IP2Proxy Web Service API. The following table outlines some of the key official SDKs:

Language Package/Module Installation Command (Example) Description
PHP ip2proxy/ip2proxy-php composer require ip2proxy/ip2proxy-php Enables PHP applications to detect proxy information from IP addresses.
ASP.NET (C#) IP2Proxy (NuGet) Install-Package IP2Proxy Integrates into .NET projects for proxy detection.
Java com.ip2proxy:ip2proxy-java (Maven) <dependency><groupId>com.ip2proxy</groupId><artifactId>ip2proxy-java</artifactId><version>...</version></dependency> Provides Java classes for IP2Proxy lookups.
Python IP2Proxy (PyPI) pip install IP2Proxy Python library for querying IP2Proxy databases or web service.
Ruby ip2proxy-ruby (RubyGems) gem install ip2proxy-ruby Ruby gem for integrating IP2Proxy functionality.
Node.js ip2proxy (npm) npm install ip2proxy Node.js module for IP2Proxy lookups in JavaScript environments.
Perl IP2Proxy (CPAN) cpan IP2Proxy Perl module for IP2Proxy database queries.
C libIP2Proxy (Manual compilation) C library for direct database file access, suitable for high-performance applications.
Go github.com/ip2proxy/ip2proxy-go go get github.com/ip2proxy/ip2proxy-go Go module for IP2Proxy integration.

For the most up-to-date list of SDKs and their specific versions, developers should consult the official IP2Proxy developer documentation.

Installation

Installation methods for IP2Proxy SDKs vary by programming language and ecosystem. Generally, SDKs are distributed through standard package managers for each language. Below are common installation patterns:

  • PHP: Typically installed via Composer, the dependency manager for PHP. A command like composer require ip2proxy/ip2proxy-php adds the library to your project.
  • ASP.NET (C#): Integrated using NuGet, the package manager for .NET. This can be done through the Visual Studio Package Manager Console with Install-Package IP2Proxy or by searching for 'IP2Proxy' in the NuGet Package Manager UI.
  • Java: Often managed with Maven or Gradle. For Maven, dependencies are declared in the pom.xml file. For Gradle, dependencies are added to build.gradle.
  • Python: Installed using pip, the Python package installer. The command pip install IP2Proxy will fetch and install the latest version from PyPI.
  • Ruby: Distributed as a RubyGem. Installation is typically done using the gem install ip2proxy-ruby command.
  • Node.js: Installed via npm, the Node.js package manager. The command npm install ip2proxy adds the module to your node_modules directory.
  • Perl: Available on CPAN (Comprehensive Perl Archive Network). Can be installed using the CPAN shell with cpan IP2Proxy.
  • C: The C library is usually provided as source code or pre-compiled binaries. Installation typically involves downloading the source, compiling it with a C compiler (e.g., GCC), and linking it against your application. Specific instructions are provided in the C library documentation.
  • Go: Managed using Go modules. The command go get github.com/ip2proxy/ip2proxy-go retrieves the module.

After installation, the next step involves downloading an IP2Proxy database file (e.g., PX11.BIN) and placing it in a location accessible by your application, unless opting for the Web Service API. IP2Proxy databases are updated regularly, and many SDKs include methods for updating or specifying the database path.

Quickstart example

This quickstart example demonstrates how to use the IP2Proxy Python SDK to query an IP address against a local database file to obtain proxy information. Before running this code, ensure you have installed the IP2Proxy Python SDK and downloaded an IP2Proxy database (e.g., PX11.BIN).

First, install the Python SDK:

pip install IP2Proxy

Next, download an IP2Proxy database file, such as IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER-PX11.BIN, from the IP2Proxy website and save it in the same directory as your Python script, or specify its full path.

Then, use the following Python code snippet:

import IP2Proxy

# Initialize the IP2Proxy object
# Replace 'IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER-PX11.BIN' 
# with the actual path to your downloaded IP2Proxy database file.
# You can download a free LITE database from ip2proxy.com/downloads

db = IP2Proxy.IP2Proxy()
db.open('IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER-PX11.BIN')

# IP address to query
ip_address = '1.0.0.1'

# Query the IP address
record = db.get_all(ip_address)

# Print the results
print(f"IP Address: {ip_address}")
print(f"Is Proxy: {record['isProxy']}")
print(f"Proxy Type: {record['proxyType']}")
print(f"Country Code: {record['countryShort']}")
print(f"Country Name: {record['countryLong']}")
print(f"Region: {record['region']}")
print(f"City: {record['city']}")
print(f"ISP: {record['isp']}")
print(f"Domain: {record['domain']}")
print(f"Usage Type: {record['usageType']}")
print(f"ASN: {record['asn']}")
print(f"AS Name: {record['asName']}")
print(f"Last Seen: {record['lastSeen']}")
print(f"Threat: {record['threat']}")
print(f"Residential: {record['residential']}")
print(f"Provider: {record['provider']}")

# Close the database connection when done (optional, but good practice)
db.close()

This example demonstrates a direct database lookup. For integrating with the IP2Proxy Web Service, the approach would involve making HTTP requests to the API endpoint, typically handled by the SDK's web service client if available, and parsing the JSON response. The HTTP status codes would indicate the success or failure of the web service request.

Community libraries

While IP2Proxy provides a range of official SDKs, the broader developer community may also contribute third-party libraries, wrappers, or integrations. These community-driven projects can offer alternative implementations, support for less common languages or frameworks, or specialized functionalities not present in the official SDKs. Community libraries might be found on platforms like GitHub, GitLab, or language-specific package repositories.

When considering community libraries, it is important to evaluate their maintenance status, documentation quality, and active development to ensure they meet project requirements for reliability and security. Developers should refer to IP2Proxy's official developer resources for guidance on recommended integration methods and to ensure compatibility with the latest database formats or API versions.