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
| |
|
Welcome to AstaHost - Dear Guest | |
User Ip And City Tracing In Php
Started by arunkumarhg, Dec 21 2004 12:41 PM
3 replies to this topic
#2
Posted 21 December 2004 - 03:44 PM
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.
$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.
#3
Posted 21 December 2004 - 08:47 PM
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.
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.
#4
Posted 22 December 2004 - 11:22 AM
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
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
Reply to this topic
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











