Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-27-2013, 01:35 PM   PM User | #1
Spudster
New Coder

 
Join Date: Jul 2012
Posts: 54
Thanks: 5
Thanked 0 Times in 0 Posts
Spudster is an unknown quantity at this point
Getting Countries IP

Hey,

I am trying to get The country of An list of ip addresses Which logs in a user account for example how would I get the ips country? Then i can post it in the database.
Spudster is offline   Reply With Quote
Old 02-27-2013, 05:03 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
You can attempt to use the PECL GEOIP library to retrieve the country code associated with an IP.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 02-27-2013, 06:21 PM   PM User | #3
tempz
Regular Coder

 
Join Date: Jul 2012
Location: London
Posts: 436
Thanks: 4
Thanked 80 Times in 80 Posts
tempz is an unknown quantity at this point
Take a look at: http://ipinfodb.com/ip_location_api.php
tempz is offline   Reply With Quote
Old 02-27-2013, 09:17 PM   PM User | #4
Spudster
New Coder

 
Join Date: Jul 2012
Posts: 54
Thanks: 5
Thanked 0 Times in 0 Posts
Spudster is an unknown quantity at this point
Ok thanks I let yous know how This goes.
Spudster is offline   Reply With Quote
Old 02-28-2013, 03:35 AM   PM User | #5
Spudster
New Coder

 
Join Date: Jul 2012
Posts: 54
Thanks: 5
Thanked 0 Times in 0 Posts
Spudster is an unknown quantity at this point
How can i submit the country into the database From the site?

Thanks for The help so far :.)
Spudster is offline   Reply With Quote
Old 02-28-2013, 01:31 PM   PM User | #6
Spudster
New Coder

 
Join Date: Jul 2012
Posts: 54
Thanks: 5
Thanked 0 Times in 0 Posts
Spudster is an unknown quantity at this point
Now how would I submit the country into the database?

Thanks!
Spudster is offline   Reply With Quote
Old 02-28-2013, 01:40 PM   PM User | #7
Arcticwarrio
Regular Coder

 
Arcticwarrio's Avatar
 
Join Date: May 2012
Location: UK
Posts: 576
Thanks: 15
Thanked 64 Times in 64 Posts
Arcticwarrio is on a distinguished road
looks like $locations will hold the value

PHP Code:
//Get errors and locations
$locations $ipLite->getCity($_SERVER['REMOTE_ADDR']);
$errors $ipLite->getError(); 
__________________
There are 10 types of people on CodingForums,
Those who understand Binary and those who dont.
Arcticwarrio is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:34 AM.


Advertisement
Log in to turn off these ads.