File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ function getIspInfo_ipinfoApi($ip){
138138 require_once ("geoip2.phar " );
139139}
140140function getIspInfo_ipinfoOfflineDb ($ ip ){
141- if (!file_exists (OFFLINE_IPINFO_DB_FILE ) || !is_readable (OFFLINE_IPINFO_DB_FILE )){
141+ if (PHP_MAJOR_VERSION < 8 || !file_exists (OFFLINE_IPINFO_DB_FILE ) || !is_readable (OFFLINE_IPINFO_DB_FILE )){
142142 return null ;
143143 }
144144 $ reader = new MaxMind \Db \Reader (OFFLINE_IPINFO_DB_FILE );
@@ -181,21 +181,16 @@ function formatResponse_simple($ip,$ispName=null){
181181 if (is_string ($ localIpInfo )) {
182182 echo formatResponse_simple ($ ip ,$ localIpInfo );
183183 }else {
184- //ipinfo API and offline db require PHP 8 or newer
185- if (PHP_MAJOR_VERSION >= 8 ){
186- $ r =getIspInfo_ipinfoApi ($ ip );
184+ $ r =getIspInfo_ipinfoApi ($ ip );
185+ if (!is_null ($ r )){
186+ echo $ r ;
187+ }else {
188+ $ r =getIspInfo_ipinfoOfflineDb ($ ip );
187189 if (!is_null ($ r )){
188190 echo $ r ;
189191 }else {
190- $ r =getIspInfo_ipinfoOfflineDb ($ ip );
191- if (!is_null ($ r )){
192- echo $ r ;
193- }else {
194- echo formatResponse_simple ($ ip );
195- }
192+ echo formatResponse_simple ($ ip );
196193 }
197- }else {
198- echo formatResponse_simple ($ ip );
199194 }
200195 }
201196}else {
You can’t perform that action at this time.
0 commit comments