Skip to content

Commit

Permalink
Update IP2ProxyCoresController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ip2location authored Apr 21, 2022
1 parent 2d5f939 commit c842b11
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Controller/IP2ProxyCoresController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@ public function index()

public function get($ip, $db = '')
{
$obj = new \IP2Proxy\Database();

if($db == '') {
$obj->open(ROOT . DS . 'vendor' . DS . 'ip2location' . DS . 'ip2proxy-cakephp' . DS . 'src' . DS . 'Data' . DS . 'IP2PROXY.BIN', \IP2Proxy\Database::FILE_IO);
$obj = new \IP2Proxy\Database(ROOT . DS . 'vendor' . DS . 'ip2location' . DS . 'ip2proxy-cakephp' . DS . 'src' . DS . 'Data' . DS . 'IP2PROXY.BIN', \IP2Proxy\Database::FILE_IO);
} else {
$obj->open($db, \IP2Proxy\Database::FILE_IO);
$obj= new \IP2Proxy\Database($db, \IP2Proxy\Database::FILE_IO);
}

try {
$records = $obj->getAll($ip);
$records = $obj->lookup($ip, \IP2PROXY\Database::ALL);
} catch (Exception $e) {
return null;
}
Expand Down

0 comments on commit c842b11

Please sign in to comment.