File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -54,12 +54,14 @@ public function getCountryCode($ip)
5454 }
5555
5656 if (!$ this ->ipToCountry [$ ip ]) {
57- $ datFile = realpath (dirname (__FILE__ ) . '/../data/GeoLite2-Country.mmdb ' );
58- $ reader = new \GeoIp2 \Database \Reader ($ datFile );
59- $ record = $ reader ->country ($ ip );
60- if ($ record && $ record ->country && $ record ->country ->isoCode ) {
61- $ this ->ipToCountry [$ ip ] = $ record ->country ->isoCode ;
62- }
57+ try {
58+ $ datFile = realpath (dirname (__FILE__ ) . '/../data/GeoLite2-Country.mmdb ' );
59+ $ reader = new \GeoIp2 \Database \Reader ($ datFile );
60+ $ record = $ reader ->country ($ ip );
61+ if ($ record && $ record ->country && $ record ->country ->isoCode ) {
62+ $ this ->ipToCountry [$ ip ] = $ record ->country ->isoCode ;
63+ }
64+ } catch (\Exception $ e ) {}
6365 }
6466
6567 if (!$ this ->ipToCountry [$ ip ]) {
You can’t perform that action at this time.
0 commit comments