Answer the question
In order to leave comments, you need to log in
ipgeobase health check?
I am making an online store website. How to check if ipgeobase is working? I am in Nizhny Novgorod, the location displays correctly. I want to know if the cities are displayed correctly.
<?php
require_once("./geo/ipgeobase.php");
header('Content-type: text/html;charset=utf-8');
$gb = new IPGeoBase();
$ip = $_SERVER['REMOTE_ADDR']?:($_SERVER['HTTP_X_FORWARDED_FOR']?:$_SERVER['HTTP_CLIENT_IP']);
$data = $gb->getRecord($ip);
echo $data['city'] ;
$slider_price_Nizhniy_Novgorod = 1350;
$slider_price_Kazan = 1450;
$slider_price_Samara = 1550;
$slider_price_Cheboksary = 1650;
$slider_price_Penza = 1750;
$slider_price_Saratov = 1850;
$slider_price_Orenburg = 1950;
$slider_price_Ulyanovsk = 2000;
$slider_price_Naberezhnye_Chelny = 2100;
switch ($data['city']) {
case 'Нижний Новгород':
echo $slider_price_Nizhniy_Novgorod;
break;
case 'Казань':
echo $slider_price_Kazan;
break;
case 'Самара':
echo $slider_price_Samara;
break;
case 'Чебоксары':
echo $slider_price_Cheboksary;
break;
case 'Пенза':
echo $slider_price_Penza;
break;
case 'Саратов':
echo $slider_price_Saratov;
break;
case 'Оренбург':
echo $slider_price_Orenburg;
break;
case 'Ульяновск':
echo $slider_price_Ulyanovsk;
break;
case 'Набережные Челны':
echo $slider_price_Naberezhnye_Chelny;
break;
default:
echo $slider_price_Nizhiy_Novgorod;
break;
}
//var_dump($data);
//echo json_encode( $data );
?>
Answer the question
In order to leave comments, you need to log in
The link blog.ivru.net/?id=82 provides the class code for working with the IpGeobase database as well as caching requests (so that you do not request the same address stack from the ipGeoBase server several times and, as a result, reduce the response time of your site
) regarding the health check, requests to ipGeoBase are sent to the address ipgeobase.ru:7020/geo?ip=193.232.224.10 (an example for the city of Ivanovo is given by the link - it was determined correctly)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question