INTELLIGENT WORK FORUMS FOR COMPUTER PROFESSIONALS
Come Join Us!
Are you a Computer / IT professional? Join Tek-Tips now!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts
- Keyword Search
- One-Click Access To Your
Favorite Forums
- Automated Signatures
On Your Posts
- Best Of All, It's Free!
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
Partner With Us!
"Best Of Breed" Forums Add Stickiness To Your Site

(Download This Button Today!)
Member Feedback
"...This site is awesome!...Things I have been trying to figure out for weeks, I got the answer in hours!..."
Geography
Where in the world do Tek-Tips members come from?
|
find user location based on IP address or host address
|
|
|
neisye (Programmer) |
17 Apr 08 18:50 |
hi, How do you find user location based on IP address or host address. in php.
thanks, arden |
|
|
Foamcow (Programmer) |
17 Apr 08 19:10 |
Get hold of a data source that has IP/Geo data. I don't think you can work it out from the numbers alone. -- Tek-Tips Forums is Member Supported. Click Here to donate
<honk>*:O)</honk>
Tyres: Mine's a pint of the black stuff. Mike: You can't drink a pint of Bovril.
|
|
|
sen5241b (IS/IT--Management) |
17 Apr 08 22:35 |
get IP: CODE$ip = $_SERVER['REMOTE_ADDR']; |
|
Use this CODE$IP = $_SERVER['REMOTE_ADDR']; $SSID = htmlentities(SID); // If IP address exists // Get country (and City) via api.hostip.info if (!empty($IP)) { $country=file_get_contents('http://api.hostip.info/get_html.php?ip='.$IP);
// Reformat the data returned (Keep only country and country abbr. list ($_country) = explode ("\n", $country); $_country = str_replace("Country: ", "", $_country); } Good luck! |
|
Don't forget that any proxy might trick the result |
|
I also forgot to mention that this is totally dependent on the target URL being up and running.
You may experience slow performance while making the inquiry.
Hope all goes well! |
|
|
 |
|