Skip to content

Commit 5488c3c

Browse files
committed
Added supports for PX9 & PX10.
1 parent 2049b73 commit 5488c3c

File tree

3 files changed

+342
-274
lines changed

3 files changed

+342
-274
lines changed

README.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ Below are the methods supported in this class.
1818
|---|---|
1919
|open|Open the IP2Proxy BIN data for lookup. Please see the **Usage** section of the 3 modes supported to load the BIN data file.|
2020
|close|Close and clean up the file pointer.|
21-
|getPackageVersion|Get the package version (1 to 4 for PX1 to PX4 respectively).|
21+
|getPackageVersion|Get the package version (1 to 10 for PX1 to PX10 respectively).|
2222
|getModuleVersion|Get the module version.|
2323
|getDatabaseVersion|Get the database version.|
2424
|isProxy|Check whether if an IP address was a proxy. Returned value:<ul><li>-1 : errors</li><li>0 : not a proxy</li><li>1 : a proxy</li><li>2 : a data center IP address</li></ul>|
2525
|getAll|Return the proxy information in array.|
26-
|getProxyType|Return the proxy type. Please visit <a href="https://www.ip2location.com/databases/px4-ip-proxytype-country-region-city-isp" target="_blank">IP2Location</a> for the list of proxy types supported|
26+
|getProxyType|Return the proxy type. Please visit <a href="https://www.ip2location.com/database/px10-ip-proxytype-country-region-city-isp-domain-usagetype-asn-lastseen-threat-residential" target="_blank">IP2Location</a> for the list of proxy types supported|
2727
|getCountryShort|Return the ISO3166-1 country code (2-digits) of the proxy.|
2828
|getCountryLong|Return the ISO3166-1 country name of the proxy.|
2929
|getRegion|Return the ISO3166-2 region name of the proxy. Please visit <a href="https://www.ip2location.com/free/iso3166-2" target="_blank">ISO3166-2 Subdivision Code</a> for the information of ISO3166-2 supported|
@@ -34,15 +34,16 @@ Below are the methods supported in this class.
3434
|getASN|Autonomous system number (ASN).|
3535
|getAS|Autonomous system (AS) name.|
3636
|getLastSeen|Proxy last seen in days.|
37+
|getThreat|Security threat reported.|
3738

3839

3940

4041
### Web Service Class
4142

4243
| Method Name | Description |
4344
| ----------- | ------------------------------------------------------------ |
44-
| Constructor | Expect 3 input parameters:<ol><li>IP2Proxy API Key.</li><li>Package (PX1 - PX8)</li><li>Use HTTPS or HTTP</li></ol> |
45-
| lookup | Return the proxy information in array.<ul><li>countryCode</li><li>countryName</li><li>regionName</li><li>cityName</li><li>isp</li><li>domain</li><li>usageType</li><li>asn</li><li>as</li><li>lastSeen</li><li>proxyType</li><li>isProxy</li></ul> |
45+
| Constructor | Expect 3 input parameters:<ol><li>IP2Proxy API Key.</li><li>Package (PX1 - PX10)</li><li>Use HTTPS or HTTP</li></ol> |
46+
| lookup | Return the proxy information in array.<ul><li>countryCode</li><li>countryName</li><li>regionName</li><li>cityName</li><li>isp</li><li>domain</li><li>usageType</li><li>asn</li><li>as</li><li>lastSeen</li><li>threat</li><li>proxyType</li><li>isProxy</li></ul> |
4647
| getCredit | Return remaining credit of the web service account. |
4748

4849

@@ -61,7 +62,7 @@ Open and read IP2Proxy binary database. There are 3 modes:
6162
require 'class.IP2Proxy.php';
6263

6364
$db = new \IP2Proxy\Database();
64-
$db->open('./samples/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN.SAMPLE.BIN', \IP2Proxy\Database::FILE_IO);
65+
$db->open('./samples/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL.SAMPLE.BIN', \IP2Proxy\Database::FILE_IO);
6566
```
6667

6768
To start lookup result from database, use the following codes:
@@ -82,7 +83,7 @@ echo '<p><strong>State: </strong>' . $records['regionName'] . '</p>';
8283
echo '<p><strong>City: </strong>' . $records['cityName'] . '</p>';
8384

8485
/*
85-
Type of proxy: VPN, TOR, DCH, PUB, WEB
86+
Type of proxy: VPN, TOR, DCH, PUB, WEB, RES (RES available in PX10 only)
8687
*/
8788
echo '<p><strong>Proxy Type: </strong>' . $records['proxyType'] . '</p>';
8889

@@ -109,6 +110,9 @@ echo '<p><strong>AS: </strong>' . $as . '</p>';
109110

110111
$lastSeen = $db->getLastSeen('1.0.241.135');
111112
echo '<p><strong>Last Seen: </strong>' . $lastSeen . '</p>';
113+
114+
$threat = $db->getThreat('1.0.241.135');
115+
echo '<p><strong>Threat: </strong>' . $threat . '</p>';
112116
```
113117

114118
Note: if you are getting error such as `Call to undefined function IP2Proxy\gmp_import()`, you probably did not have the module to install or enable in php.ini. You can check your php.ini to make sure that the module has been enabled.
@@ -123,7 +127,7 @@ Start your lookup by following codes:
123127
require 'class.IP2Proxy.php';
124128

125129
// Lookup by Web API
126-
$ws = new \IP2Proxy\WebService('YOUR_API_KEY', 'PX8', false);
130+
$ws = new \IP2Proxy\WebService('YOUR_API_KEY', 'PX10', false);
127131

128132
$results = $ws->lookup('1.0.241.135');
129133

@@ -139,6 +143,7 @@ if ($results !== false) {
139143
echo '<p><strong>AS: </strong>' . $results['as'] . '</p>';
140144
echo '<p><strong>Last Seen: </strong>' . $results['lastSeen'] . ' Day(s)</p>';
141145
echo '<p><strong>Proxy Type: </strong>' . $results['proxyType'] . '</p>';
146+
echo '<p><strong>Threat: </strong>' . $results['threat'] . '</p>';
142147
echo '<p><strong>Is Proxy: </strong>' . $results['isProxy'] . '</p>';
143148
}
144149
```

0 commit comments

Comments
 (0)