test geoip

This commit is contained in:
xiaomlove
2021-06-07 03:38:50 +08:00
parent 5e6cfc3845
commit a2a0df5fd2
4 changed files with 281 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ use App\Repositories\ExamRepository;
use App\Repositories\SearchBoxRepository;
use App\Repositories\TorrentRepository;
use Carbon\Carbon;
use GeoIp2\Database\Reader;
use Illuminate\Console\Command;
use Illuminate\Encryption\Encrypter;
use Illuminate\Support\Facades\DB;
@@ -50,8 +51,11 @@ class Test extends Command
*/
public function handle()
{
$r = \Nexus\Database\DB::getConnection();
dd($r);
$reader = new Reader(resource_path('geoip/GeoLite2-City.mmdb'));
$record = $reader->city('128.101.101.101');
dump($record->city, $record->country, $record->location);
$record2 = $reader->isp('128.101.101.101');
dump($record2->isp);
}
}