Skip to content

Commit 0ccf293

Browse files
committed
Update README.md
1 parent 4d03532 commit 0ccf293

File tree

1 file changed

+2
-117
lines changed

1 file changed

+2
-117
lines changed

README.md

Lines changed: 2 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -7,123 +7,8 @@ This module allows user to query an IP address if it was being used as open prox
77
* Free IP2Proxy BIN Data: https://lite.ip2location.com
88
* Commercial IP2Proxy BIN Data: https://www.ip2location.com/proxy-database
99

10-
## Methods
11-
Below are the methods supported in this class.
12-
13-
14-
15-
### BIN Database Class
16-
17-
| Function Name | Description |
18-
|---|---|
19-
|Constructor|Expect 2 input parameters:<ol><li>Full path of IP2Proxy BIN data file.</li><li>File Open Mode<ul><li> SHARED_MEMORY</li><li>MEMORY_CACHE</li><li>FILE_IO</li></ul></li></ol>For SHARED_MEMORY and MEMORY_CACHE, it will require your server to have sufficient memory to hold the BIN data, otherwise it will raise the errors during the object initialization.|
20-
|**string** getDatabaseVersion()|Return the database's compilation date as a string of the form 'YYYY-MM-DD',|
21-
|**string** getPackageVersion()|Return the database's type, 1 to 10 respectively for PX1 to PX11. Please visit https://www.ip2location.com/databases/ip2proxy for details.|
22-
|**string** getModuleVersion()|Return the version of module.|
23-
|**array** lookup($ip)|Return the IP information in array. Below is the information returned:<ul><li>ipNumber</li><li>ipVersion</li><li>ipAddress</li><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><li>provider</li></ul>You can visit [IP2Location](https://www.ip2location.com/database/px11-ip-proxytype-country-region-city-isp-domain-usagetype-asn-lastseen-threat-residential-provider) website for the description of each field. Note: although the above names are not exactly matched with the names given in this link, but they are self-described.|
24-
25-
26-
27-
### Web Service Class
28-
29-
| Method Name | Description |
30-
| ----------- | ------------------------------------------------------------ |
31-
| Constructor | Expect 3 input parameters:<ol><li>IP2Proxy API Key.</li><li>Package (PX1 - PX11)</li><li>Use HTTPS or HTTP</li></ol> |
32-
| 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><li>provider</li></ul> |
33-
| getCredit | Return remaining credit of the web service account. |
34-
35-
36-
37-
## Usage
38-
39-
### BIN Database
40-
41-
Open and read IP2Proxy binary database. There are 3 modes:
42-
43-
1. **\IP2Proxy\Database::FILE_IO** - File I/O reading. Slower look, but low resource consuming.
44-
2. **\IP2Proxy\Database::MEMORY_CACHE** - Caches database into memory for faster lookup. Required high memory.
45-
3. **\IP2Proxy\Database::SHARED_MEMORY** - Stores whole IP2Proxy database into system memory. Lookup is possible across all applications within the system. Extremely resources consuming. Do not use this mode if your system do not have enough memory.
46-
47-
```php
48-
require 'vendor/autoload.php';
49-
50-
$db = new \IP2Proxy\Database('vendor/ip2location/ip2proxy-php/data/PX11.SAMPLE.BIN', \IP2PROXY\Database::FILE_IO);
51-
```
52-
53-
To start lookup result from database, use the following codes:
54-
55-
```php
56-
$records = $db->lookup('1.0.0.8', \IP2PROXY\Database::ALL);
57-
```
58-
59-
Results are returned in array.
60-
61-
```php
62-
echo '<p><strong>IP Address: </strong>' . $records['ipAddress'] . '</p>';
63-
echo '<p><strong>IP Number: </strong>' . $records['ipNumber'] . '</p>';
64-
echo '<p><strong>IP Version: </strong>' . $records['ipVersion'] . '</p>';
65-
echo '<p><strong>Country Code: </strong>' . $records['countryCode'] . '</p>';
66-
echo '<p><strong>Country: </strong>' . $records['countryName'] . '</p>';
67-
echo '<p><strong>State: </strong>' . $records['regionName'] . '</p>';
68-
echo '<p><strong>City: </strong>' . $records['cityName'] . '</p>';
69-
70-
/*
71-
Type of proxy: VPN, TOR, DCH, PUB, WEB, RES (RES available in PX11 only)
72-
*/
73-
echo '<p><strong>Proxy Type: </strong>' . $records['proxyType'] . '</p>';
74-
75-
/*
76-
Returns -1 on errors
77-
Returns 0 is not proxy
78-
Return 1 if proxy
79-
Return 2 if it's data center IP
80-
*/
81-
echo '<p><strong>Is Proxy: </strong>' . $records['isProxy'] . '</p>';
82-
echo '<p><strong>ISP: </strong>' . $records['isp'] . '</p>';
83-
echo '<p><strong>Domain: </strong>' . $records['domain'] . '</p>';
84-
echo '<p><strong>Usage Type: </strong>' . $records['usageType'] . '</p>';
85-
echo '<p><strong>ASN: </strong>' . $records['asn'] . '</p>';
86-
echo '<p><strong>AS: </strong>' . $records['as'] . '</p>';
87-
echo '<p><strong>Last Seen: </strong>' . $records['lastSeen'] . '</p>';
88-
echo '<p><strong>Threat: </strong>' . $records['threat'] . '</p>';
89-
echo '<p><strong>Provider: </strong>' . $records['provider'] . '</p>';
90-
```
91-
92-
93-
94-
### Web Service API
95-
96-
To lookup by Web service, you will need to sign up for [IP2Proxy Web Service](https://www.ip2location.com/web-service/ip2proxy) to get a API key.
97-
98-
Start your lookup by following codes:
99-
100-
```php
101-
require 'vendor/autoload.php';
102-
103-
// Lookup by Web API
104-
$ws = new \IP2Proxy\WebService('YOUR_API_KEY', 'PX11', false);
105-
106-
$results = $ws->lookup('1.0.241.135');
107-
108-
if ($results !== false) {
109-
echo '<p><strong>Country Code: </strong>' . $results['countryCode'] . '</p>';
110-
echo '<p><strong>Country Name: </strong>' . $results['countryName'] . '</p>';
111-
echo '<p><strong>Region: </strong>' . $results['regionName'] . '</p>';
112-
echo '<p><strong>City: </strong>' . $results['cityName'] . '</p>';
113-
echo '<p><strong>ISP: </strong>' . $results['isp'] . '</p>';
114-
echo '<p><strong>Domain: </strong>' . $results['domain'] . '</p>';
115-
echo '<p><strong>Usage Type: </strong>' . $results['usageType'] . '</p>';
116-
echo '<p><strong>ASN: </strong>' . $results['asn'] . '</p>';
117-
echo '<p><strong>AS: </strong>' . $results['as'] . '</p>';
118-
echo '<p><strong>Last Seen: </strong>' . $results['lastSeen'] . ' Day(s)</p>';
119-
echo '<p><strong>Proxy Type: </strong>' . $results['proxyType'] . '</p>';
120-
echo '<p><strong>Threat: </strong>' . $results['threat'] . '</p>';
121-
echo '<p><strong>Provider: </strong>' . $results['provider'] . '</p>';
122-
echo '<p><strong>Is Proxy: </strong>' . $results['isProxy'] . '</p>';
123-
}
124-
```
125-
126-
10+
## Developer Documentation
11+
To learn more about installation, usage, and code examples, please visit the developer documentation at [https://ip2proxy-php.readthedocs.io/en/latest/index.html.](https://ip2proxy-php.readthedocs.io/en/latest/index.html)
12712

12813
# Reference
12914

0 commit comments

Comments
 (0)