PHP code example of halo123450 / iplocation
1. Go to this page and download the library: Download halo123450/iplocation library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
halo123450 / iplocation example snippets
Halo123450\IpLocation\DbSearcher;
$dbSearcher = new DbSearcher("/path/to/your/database.czdb", "BTREE", "YourEncryptionKey");
$ip = "8.8.8.8";
// 如果批量查询,则建议使用$dbSearcher->search($ip); 执行完后关闭数据库: $dbSearcher->close();
$region = $dbSearcher->query($ip);
echo "搜索结果:\n";
print_r($region);