17 | | == Usage == |
18 | | To resolve an IP address:[[BR]] |
19 | | '''java -jar ip2c.jar ip-address'''[[BR]] |
20 | | Output format:[[BR]] |
21 | | if not found:[[BR]] |
22 | | UNKNOWN[[BR]] |
23 | | [[BR]] |
24 | | if found:[[BR]] |
25 | | 2C 3C NAME[[BR]] |
26 | | [[BR]] |
27 | | Example:[[BR]] |
28 | | '''java -jar ip2c.jar 85.64.225.159'''[[BR]] |
29 | | Outputs:[[BR]] |
30 | | IL ISR ISRAEL[[BR]] |
31 | | [[BR]] |
32 | | To build binary file from CSV file:[[BR]] |
33 | | '''java -jar ip2c csv_file bin_file'''[[BR]] |
| 17 | |
| 18 | == JAVA == |
| 19 | Usage : |
| 20 | To resolve an IP address: |
| 21 | java -jar ip2c.jar ip-address |
| 22 | Output format: |
| 23 | if not found: |
| 24 | UNKNOWN |
| 25 | |
| 26 | if found: |
| 27 | 2C 3C NAME |
| 28 | |
| 29 | Example: |
| 30 | java -jar ip2c.jar 85.64.225.159 |
| 31 | Outputs: |
| 32 | IL ISR ISRAEL |
| 33 | |
| 34 | To build binary file from CSV: |
| 35 | java -jar ip2c csv_file bin_file |
| 36 | |
| 37 | == PHP == |
| 38 | Install the ip2country.php and the binary file in the same directroy. |
| 39 | |
| 40 | {{{ |
| 41 | #!php |
| 42 | |
| 43 | <?php |
| 44 | require_once('ip2country.php'); |
| 45 | |
| 46 | $ip2c = new ip2country(); |
| 47 | $res = $ip2c->get_country("85.64.225.159"); |
| 48 | if ($res == false) |
| 49 | echo "not found"; |
| 50 | else |
| 51 | { |
| 52 | $o2c = $res['id2']; |
| 53 | $o3c = $res['id3']; |
| 54 | $oname = $res['name']; |
| 55 | echo "$o2c $o3c $oname"; // will output IL ISR ISRAEL |
| 56 | } |
| 57 | ?> |
| 58 | }}} |