What is the best PHP ip to latitude longitude class? #ip to latitude longitude
Edit
by Vitor Rodrigues - 9 years ago (2015-05-24)
Given IP address return latitude longitude
| I need a class that for a given IP it will return the latitude and longitude coordinates, the region, the city, the country, the county, etc..
Some one already create a class like this but it doesn't work. I am the second person complain that the class doesn't work the first was some one call Joe. |
- 1 Clarification request
1.
by Dave Smith - 9 years ago (2015-05-24) Reply
After re-reading the request, you are actually looking for a geo locator and not a geocoder. For a geo locator, I would look at this one...
http://www.phpclasses.org/geoplugin
Dave
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... |
IP2Location PHP Module: Get geographical details of an IP with IP2Location
This class can get geographical details of an IP with IP2Location.
It can read and parse an IP2Location data file made available in the IP2Location site, so it can locate a given IP address and get geographical details associated to the IP address range.
Currently it can extract details like the country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection speed, IDD code, area code, weather station code, weather station name, mcc, mnc, mobile brand, and elevation.
This class can work with both the commercial and free versions of IP2Location database.
| by Manuel Lemos 26695 - 9 years ago (2015-05-28) Comment
The problem of those packages that stop working is that they rely on Web services that are no longer available.
An alternative solution is to use a package that can use a IP database file, so you can download and use locally.
This class implements that approach using a free IP2Location database. You will need to download it the database file now and probably later periodically, so you can use an updated IP database. |
Simple GMap API: Display maps and get location with Google Maps API
This package can be used to display maps in Web pages using the Google Maps API V3.
It can generate HTML with JavaScript can display maps on Web pages using the Google Maps API. The maps may show additional features, such as markers, information windows, circles, rectangles and navigation controls.
A separate class can also use the GeoCode support of the Google Maps Web services API to determine the geographic coordinates of a location, or determine the address of a location given its coordinates.
| by Dave Smith 7620 - 9 years ago (2015-05-24) Comment
There are a lot of geocoders available using google API's, however google changes their API's frequently. The latest version is V3 and any classes uses older versions will not work.
I would try this one first. While it mainly is for displaying mapped locations, it uses V3 and has a geocoder that you can use to get the additional information you are after.
Dave |
- 1 Comment
1.
by Manuel Lemos - 9 years ago (2015-05-28) Reply
Yes, Dave, as you realized that was not really what was asked.