D
D
Dmitry Koshelenko2010-11-29 15:10:03
PHP
Dmitry Koshelenko, 2010-11-29 15:10:03

Do you need an analogue of the GeoIP extension (determining the country by IP address)?

We need the above module for determining the country by the IP address of the visitor in PHP.
I would gladly take a third-party one, but unfortunately I didn’t find anything sensible at once, taking into account my conditions. I would take "GeoIP", but there, as I understand it, certain gestures of the hoster are needed, it does not suit me. Solutions that use MySQL to work or access external resources are also not suitable.
Roughly speaking, a local file ***.php is needed (let's say complete with a local database in CSV, XML, TXT ... format), by connecting which you can call the desired function.

Having rummaged through the bins of the Internet, I found the database itself on maxmind.com - there is a binary format and CSV. Now I started writing my script in PHP, working with this database, but if someone tells me a ready-made script, I will be very grateful.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexey, 2010-11-29
@GomelHawk

No gestures of the hoster are needed. Put the base in your desired dira, php files and turn them on. I have been using it for so long.

require_once("geoip/geoip.inc");

$gip = geoip_open("geoip/GeoIP.dat", GEOIP_STANDARD);
echo geoip_country_name_by_addr($gip, $ip);
geoip_close($gip);

V
Vsevolod, 2010-11-29
@sevka_fedoroff

www.maxmind.com/app/city#api
I think there are ready-made PHP scripts for working with their local database

S
Sergey, 2010-12-08
@liaren

In PHP I use IpLoc for this purpose .

A
Alex_B, 2019-03-25
@Aleks_B

In my opinion, it is much more convenient to simply receive data through a fast API.
In this case, there is no need to store/update/maintain the database.
Try the service from BigDataCloud .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question