GEOIP and getting a computers IP address Location?

ip location
what is my ip
track ip address exact location
my ip address location is somewhere else
ip address tracker
how to check ip address
pinpoint ip address
how to trace ip address

I want my site to be able to locate a computers location, so if someone is accessing my site from london or manchester etc and to have users from a certain area displayed depending on their computers location. kind of like an online dating site that suggests users in your area.

I have been looking at this GEOIP database that lists all the cities around the world. But i dont know what to do next? Do i need to look at get ip address scripts that pull and compare the information from the GEOip database?

Please can someone point me in the right direction. Thanks.

GeoIP database from: http://dev.maxmind.com/geoip/geolite

Try the below code.

$ip =  $_SERVER['REMOTE_ADDR'];
echo $location = file_get_contents("http://api.hostip.info/country.php?ip=$ip");

Dont try this in your localhost. It will give the ip 127.0.0.1.

echo $location= file_get_contents("http://api.hostip.info/country.php?ip=12.215.42.19");
//outputs US

IP Address Lookup - Find IP Address Location, How do I get my IP address from another state? I want my site to be able to locate a computers location, so if someone is accessing my site from london or manchester etc and to have users from a certain area displayed depending on their computers location. kind of like an online dating site that suggests users in your area.

PHP has builtin functions for GeoIP

GeoIP library

This one function may be particularly useful as it will return continent, country, city etc. in an array.

geoip_record_by_name

Use $_SERVER['REMOTE_ADDR'] as your ip.

$record = geoip_record_by_name( $_SERVER['REMOTE_ADDR']);

Why is the location detection (based on my IP address) wrong?, Why does my IP address show me in a different location? 2 FreeGeoIP.net is a free web app that provides a public HTTP API for software developers to search the geo-location of any given IP address or hostname. It uses a database of IP addresses associated with cities along with some other relevant information such as time zone, latitude, and longitude, etc.

It depends on your need. I would suggest you use a web service so you do not need to worry about hosting the database and maintaining it on your own. All you need to do is parse the IP address of your visitor and get the result instantly. I am using the IP2location web service from this site.

Where is my IP location? (Geolocation), (a Suburb, City, or perhaps State, in a Country). The Internet Protocol Address (or IP Address) is a unique address that computing devices such as personal computers, tablets, and smartphones use to identify itself and communicate with other devices in the IP network. Any device connected to the IP network must have a unique IP address within the network.

I've used this one in PHP on my site. Very quick and easy to digest (xml etc): http://www.geoplugin.com/

Your IP Address's GeoIP2 Data, The location detection shown on whatismybrowser.com is based on a service called GeoIP They make a best attempt to correlate your computer's IP Address with a physical location (a Suburb, City, and are constantly updating their GeoIP database, so who knows - perhaps in the Get a VPN to help stay safe online. IP Geolocation is a technique to lookup for visitor\'s geolocation information, such as country, region, city, ZIP code/postal code, latitude, longitude, domain, ISP, area code, mobile data, weather data, usage type, proxy data, elevation and so on, using an IP address. This IP lookup data source can be found in various form, for example, database, file, and web service, for users to build the geolocation solutions.

Please note, this database is: In our recent tests, the GeoIP databases tested at 99.8% accurate on a country level, 90% accurate on a state level in the US, and 83% accurate for cities in the US within a 40 kilometer radius.

I would look into something like the: PEAR GeoLite library

A quick snippet of using this library in php:

$geoip = Net_GeoIP::getInstance(dirname(__FILE__) . '/data/GeoLiteCity.dat');
$ipaddress = '72.30.2.43'; // Yahoo!
$location = $geoip->lookupLocation($ipaddress);
var_dump($location);

The output will show, something similiar to:

object(Net_GeoIP_Location)[2]
    protected 'aData' =>
        array
        'countryCode' => string 'US' (length=2)
        'countryCode3' => string 'USA' (length=3)
        'countryName' => string 'United States' (length=13)
        'region' => string 'CA' (length=2)
        'city' => string 'Sunnyvale' (length=9)
        'postalCode' => string '94089' (length=5)
        'latitude' => float 37.4249
        'longitude' => float -122.0074
        'areaCode' => int 408
        'dmaCode' => float 807

What is GeoIP? - Nexcess, What is your public IPv4 or IPv6 address and where are you located? Find a geolocation of your IP address including latitude, longitude, city, region and country. a mechanism for finding contact and registration information for IP resources geographic location of an Internet-connected computing or a mobile device. Use GeoIP2 to find your IP address data, which includes your location, ISP, coordinates, domain, and more.

How does geolocation work?, GeoIP2 Precision: City Results. No IP addresses submitted yet. IP Address, Country Code, Location, Network, Postal Code, Approximate Coordinates  ← Powershell Tip #94: Delete files and folder longer than 259 characters Powershell Tip #96: Clear all event logs → 2 thoughts on “ Powershell Tip #95: Find the Geolocation of an IP Address ”

Inside Secrets About IP Address Geolocation, GeoIP locates a computer terminal's geographic location by identifying that terminal's IP address. Definition A form of geolocation, GeoIP refers  IP Location This free online tool allows you to see the geographical location of any IP address. Just input the IP address and you will be shown the position on a map, coordinates, country, region, city and organization.

IP2Location: IP Address to Identify Geolocation Information, As seen on: PC World, The Guardian, CNN, USA Today, Digital How Does an IP Address Give Away Your Location? (That's why you get such instant and accurate weather data with a simple query.) "IP2LocationTM is a non-intrusive geo IP solution to help you to identify [a] visitor's geographical location, i.e.[,] country,  Most often, the "geolocation" of an IP address is based on the business address of the ISP to which that IP address has been assigned. Thus, the location reported for your IP address will always be different from your own physical location.

Comments
  • Hi HexaHow - I've changed a few things in your post. Did you already find the help for formatting your answers (e.g. adding links)?