User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 374,155 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,439 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 5175 | Replies: 2
Reply
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

find county using ip address

  #1  
May 10th, 2006
$url=$_POST['url'];
$ip = gethostbyname($url);
$long1 = ip2long($ip)

if ($long1 == -1 || $long1 == FALSE)
{ echo 'Invalid IP, please try again';
}
else {

print $url;
echo $ip ?>

bu this code i get ip address but i need the country name aslo with this ip address. is thers any function to get country?
thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: somewhere in time
Posts: 71
Reputation: TopDogger is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 2
TopDogger's Avatar
TopDogger TopDogger is offline Offline
Junior Poster in Training

Re: find county using ip address

  #2  
May 16th, 2006
There is no function that identifies a country using the IP address. You will need to use a GeoIP (also called GeoLocation) database.

There are several freebie GeoIP databases available.
http://www.maxmind.com/app/geoip_country
http://ip-to-country.webhosting.info/
Reply With Quote  
Join Date: Oct 2007
Posts: 5
Reputation: attadaved is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
attadaved attadaved is offline Offline
Newbie Poster

Re: find county using ip address

  #3  
Apr 25th, 2008
Use <snipped>to get ip to country and other useful information.
Last edited by peter_budo : Apr 26th, 2008 at 7:18 am. Reason: Keep It Spam-Free - Do not spam, advertise, plug your website, or engage in any other type of self promotion.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 3:29 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC