Skip to content

Commit c842b11

Browse files
authored
Update IP2ProxyCoresController.php
1 parent 2d5f939 commit c842b11

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Controller/IP2ProxyCoresController.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@ public function index()
3232

3333
public function get($ip, $db = '')
3434
{
35-
$obj = new \IP2Proxy\Database();
36-
3735
if($db == '') {
38-
$obj->open(ROOT . DS . 'vendor' . DS . 'ip2location' . DS . 'ip2proxy-cakephp' . DS . 'src' . DS . 'Data' . DS . 'IP2PROXY.BIN', \IP2Proxy\Database::FILE_IO);
36+
$obj = new \IP2Proxy\Database(ROOT . DS . 'vendor' . DS . 'ip2location' . DS . 'ip2proxy-cakephp' . DS . 'src' . DS . 'Data' . DS . 'IP2PROXY.BIN', \IP2Proxy\Database::FILE_IO);
3937
} else {
40-
$obj->open($db, \IP2Proxy\Database::FILE_IO);
38+
$obj= new \IP2Proxy\Database($db, \IP2Proxy\Database::FILE_IO);
4139
}
4240

4341
try {
44-
$records = $obj->getAll($ip);
42+
$records = $obj->lookup($ip, \IP2PROXY\Database::ALL);
4543
} catch (Exception $e) {
4644
return null;
4745
}

0 commit comments

Comments
 (0)