IP2Proxy PHP API
This PHP module helps the user to find the IP addresses which are used as VPN anonymizer, open proxies, web proxies, Tor exits, data center & web hosting range (DCH), search engine robots (SES) and residential proxy (RES) by calling the IP2Proxy API.
NOTE: This module will require an IP2Proxy Web Service API key to function.
Installation
-
Run the command:
composer require ip2location/ip2proxy-php
Note: You just need to include the below code in order to use the library.require 'vendor/autoload.php';
Sample Codes
<?php require 'class.IP2Proxy.php'; // Lookup by Web API $ws = new \IP2Proxy\WebService('YOUR_API_KEY', 'PX10', false); $results = $ws->lookup('1.0.241.135'); if ($results !== false) { echo '<p><strong>Country Code: </strong>' . $results['countryCode'] . '</p>'; echo '<p><strong>Country Name: </strong>' . $results['countryName'] . '</p>'; echo '<p><strong>Region: </strong>' . $results['regionName'] . '</p>'; echo '<p><strong>City: </strong>' . $results['cityName'] . '</p>'; echo '<p><strong>ISP: </strong>' . $results['isp'] . '</p>'; echo '<p><strong>Domain: </strong>' . $results['domain'] . '</p>'; echo '<p><strong>Usage Type: </strong>' . $results['usageType'] . '</p>'; echo '<p><strong>ASN: </strong>' . $results['asn'] . '</p>'; echo '<p><strong>AS: </strong>' . $results['as'] . '</p>'; echo '<p><strong>Last Seen: </strong>' . $results['lastSeen'] . ' Day(s)</p>'; echo '<p><strong>Proxy Type: </strong>' . $results['proxyType'] . '</p>'; echo '<p><strong>Is Proxy: </strong>' . $results['isProxy'] . '</p>'; echo '<p><strong>Threat: </strong>' . $results['threat'] . '</p>'; } ?>