INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

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!

E-mail*
Handle

Password
Verify P'word
*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
Partner Button
(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'];
Helpful Member!southbeach (Programmer)
22 Apr 08 17:33
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!
 
webdev007 (Programmer)
23 Apr 08 7:45
Don't forget that any proxy might trick the result
Helpful Member!southbeach (Programmer)
23 Apr 08 12:29
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!

Start A New Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Promoting, selling, recruiting and student posting
are not allowed in the forums.
Posting Policies

LINK TO THIS FORUM!
(Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum)
TITLE: PHP Forum at Tek-Tips
URL: http://www.tek-tips.com/threadminder.cfm?pid=434
DESCRIPTION: PHP technical support forum and mutual help system for computer professionals. Selling and recruiting forbidden.

 

Back To Forum