Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Replying to User Ip And City Tracing In Php


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

arunkumarhg

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

cryptwizard

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.

jipman

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.

arunkumarhg

Posted 21 December 2004 - 12:41 PM

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

Review the complete topic (launches new window)