how to detect ip address based location using PHP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to detect ip address based location using PHP
# 1  
Old 07-28-2008
how to detect ip address based location using PHP

I am interested in finding out if there is a reliable and economical way for extracting user's location based on his ip address, using php

I tried to get the job done using ip2location.com, but I am not happy how it deals with result inconsistently.
# 2  
Old 07-29-2008
Unfortunatly, there's no really simple way to do this. While IP space generally maps to geographical location, this mapping is completely arbitrary, and subject to change if an IP range is sold.
One option is to use the whois service to find the owner of an IP block, then report the address they have defined there - it's not exact as this address field is free-form and/or could easily be a bald-faced lie, but it might get you part-way there...
# 3  
Old 07-29-2008
These turns up with PEAR and PECL:

PEAR :: Search: geo
PECL :: Package Search

As mentioned, the results are not necessarily accurate (some are known false results). Say, my company owns an AS and have a range of IPs allocated, that are assigned to locations at different parts of the world. Of course, if you look at netblock owner the location will be that of our company headquarters, but that does not represent the location of our servers which really got assigned those IPs. To date, I have yet to see a geolocation service or package that guesses the locations of those offshore servers right.

So, don't treat these kind of geolocation data too seriously. It will be good for, say, selecting a default language for a multi-lingual site based on an estimated location (that the user can still switch if the guess is wrong). Don't expect you will find a source, no matter how much you are willing to pay, that gives you "accurate" results, let alone zero false results.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

C program to detect duplicate ip address if any after assigning ip address to ethernet interface

Hi , Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies

2. IP Networking

Where to find IP address to location data?

I'm trying to remotely probe a range of IP addresses. First I need a list of IP addresses for a very small geographic area. I've had a lot of trouble obtaining them. I would like to find a database or something. Suppose I do get the data. Can I see if that IP address is in use by someone? Can I... (2 Replies)
Discussion started by: rockandAir
2 Replies

3. Shell Programming and Scripting

Parse based on location

I do have a big text file >A1 ACFGTSDCHG_GDF DGHA >A2 A_FGGSD_HG_GSF DGTA >A3 AC_GSDD_TU_GDF DGH_ .. ... there are equal number of characters within all the sub-headers. I want to parse out all the characters under each sub-header from user specified locations. For example, I want... (5 Replies)
Discussion started by: Lucky Ali
5 Replies

4. Web Development

PHP client location based page loading

Hi, I am new to PHP and at first got a task where I need some clues and help. So I am here.. The server is build to provide customized access for modules as per location. If client location is US then it shows modules and pages specific to US and if location is UK then it shows UK specific... (1 Reply)
Discussion started by: zing_foru
1 Replies

5. Web Development

HTML/PHP show IMG based on location

HI guys/gals, I like to add some personal touches to a welcome image on our mediawiki site, and have the welcome be displayed in the, presumed, language of the visitor. Standard would be English, but if the IP or browser or OS is set to be in India, I want to display the message in Urdu for... (5 Replies)
Discussion started by: lawstudent
5 Replies

6. UNIX for Dummies Questions & Answers

How to detect ip address from last reboot done?

Hi How would i detect the ip address from where the reboot command been given to linux host. My linux host details are as below. # lsb_release -a LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: EnterpriseEnterpriseServer Description: ... (1 Reply)
Discussion started by: pinga123
1 Replies

7. AIX

Hardware address to physical location

Hello How do I deternine the physical location of an ethernet port, based on the hardware address? I have 4 ports on a 9133-55A ent0 05-08 ent1 05-09 ent2 07-08 ent3 07-09 Two of these are internal, and two are on a card. I need to single out ent0 and ent2, but I cannot find any... (4 Replies)
Discussion started by: mhenryj
4 Replies

8. UNIX for Advanced & Expert Users

detect mac address modication in linux

Hi, How Detect the mac address modification of a machine...in linux Thanks (1 Reply)
Discussion started by: shivarajM
1 Replies

9. Shell Programming and Scripting

Need your HELP:: Shell script to detect paragraph in coordinate-based code.

Hi Friends!! I have obtained following output from a tool called pdftoxml: <xml> <text top="423" left="521" width="333" height="20" font="3">Although the the number of fuzzy rules of a system is </text> <text top="441" left="500" width="355" height="20" font="3">directly dependant on these... (2 Replies)
Discussion started by: parshant_bvcoe
2 Replies

10. UNIX for Dummies Questions & Answers

copying files from one location to another based on a list

I have a text list of about 3,000 file names (image files), which exist on a server and that I want to copy over to another location. I understand the Unix cp code, but what's the string to have it copy multiple files based on an external list? Many thanks! (4 Replies)
Discussion started by: rebornhonest
4 Replies
Login or Register to Ask a Question