Edit
by MDSAY - 10 years ago (2014-12-03)
Localization visitor country with PHP
| Hello, I need a solution to determine the country of a visitor of my Web site with PHP. |
Ask clarification
3 Recommendations
Very Simple IP Details: Get IP address location and Google Maps image
This class can get IP address location and Google Maps image.
It can send a HTTP request to the IPInfo.io API to get the geographic location details of a given IP address. Currently it can obtain IP address country code, region, city, postal code, latitude, longitude, hostname and organization.
The class can also return HTML to embed a static image from Google Maps showing the geographic location of the IP address.
| by zinsou A.A.E.Moïse package author 6835 - 7 years ago (2017-08-20) Comment
new requesters could try this, it is simple and it works fine... |
PHP Get Visitor Info: Get visitor information and store in a database
This class can get visitor information and store in a database.
It can retrieve several details about the current page visitor from it IP address and other request headers.
The retrieved information is stored in a MySQL database table.
Currently it record the user computer operating system, browser, IP address, country, city, geographical coordinates, the internet service provider or the organization using the ip-api.com Web services.
The stored data can be associated to a given server domain address.
| by Dragan Zlatkovski package author 300 - 9 years ago (2015-04-17) Comment
This is one of the best class. Store information in database for user country, city, state, Geo coordinates, IP address, ISP, ORG, and much more |
This class can determine the country of a given IP using the GeoIP country database edition.
It reads an GeoIP country database file that relates IP ranges with countries.
The class looks up a given IP to determine the country associated to the IP range that it belongs.
If found, the class returns the IP range start and end and the associated country name and code.
| by Manuel Lemos 26695 - 10 years ago (2014-12-14) Comment
There are several ways to obtain the location of a visitor.
For instance you can use HTML5 JavaScript APIs to ask the user location on the browser, but that does not get you the visitor location from the IP address.
There are also several Web services that you can call to get the location of the user from the IP address. The problem is that some that are free to use are a bit overloaded.
An alternative is to download the IP range database from GeoIP service and query that database locally on your server.
Some packages query a local MySQL database loaded with GeoIP database data. It works but you need to setup and update the database yourself. Performing too many database queries may slow down your site.
This class uses a simpler solution that consists on querying the GeoIP database file directly. No MySQL database is necessary. |