|
|
|
|
![]() ![]() |
Dec 21 2004, 12:41 PM
Post
#1
|
|
|
Advanced Member Group: Members Posts: 135 Joined: 29-November 04 From: Bangalore, India Member No.: 1,559 |
Hi,
Am in damm need of tracing the Users IP and City hwre they are from with PHP, Any help please....... Thanks in Advance Arunkumar.H.G |
|
|
|
Dec 21 2004, 03:44 PM
Post
#2
|
|
|
Pretty please? Group: Members Posts: 733 Joined: 28-November 04 From: Holland Member No.: 1,552 |
IP is easy if you mean the client that connects to your server has to be logged.
$adress = $_SERVER['REMOTE_ADDR']; insert that line and the variable $adress will be the IP you need. But city is not possible i think, because the IP only refers to the company that has registered the subnet ( first 3 digits of you ip). So you can only find out who someones ISP is. And in wich country someone is. All you need to do is a whois to the ip you just got. |
|
|
|
Dec 21 2004, 08:47 PM
Post
#3
|
|
|
Member - Active Contributor Group: Members Posts: 77 Joined: 11-December 04 Member No.: 1,704 |
To get a host name (something like xxx.70.233.220.exetel.com.au) run the IP address through gethostbyaddr($ip).
Like jipman said the IP address is accessible through $_SERVER['REMOTE_ADDR']. To get their contury, there's an API here: http://sourceforge.net/projects/geoip/ I never used it myself, but I've seen it in use on mySQL.com and it works for me. It has APIs for a wide variety of languages. Hope that helps. |
|
|
|
Dec 22 2004, 11:22 AM
Post
#4
|
|
|
Advanced Member Group: Members Posts: 135 Joined: 29-November 04 From: Bangalore, India Member No.: 1,559 |
Thanks for your reply,
recently i gone through the http://www.ip2location.com/ there they will display even city also, how it is done. Any links resources please.... Regards Arunkumar.H.G |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 2nd December 2008 - 01:02 AM |