Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
using string functions
Old 07-14-2008, 04:28 AM using string functions
Ultra Talker

Posts: 254
Trades: 0
i am using $ip= $_SERVER['REMOTE_ADDR'] to retrieve the ip address of the client for example if the value returned from $ip

is 50.160.190.150

i would like to find out which country the request has come from. i believe by using the third set of numbers (in this case=190) from an ip address we can find out the country name. i can declare a variable with a list of country names and the range of values, what i need help is to extract the 3rd set of numbers from $ip.

as ip address keep changing the 3rd set of numbers can be single, double or 3 digit number how can we extract the number that

is stored in $ip after the second dot and before the third dot

please advice.

thanks.
sudhakararaog is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-14-2008, 05:09 AM Re: using string functions
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
look for the free maxmind's geoip stuff:
http://www.maxmind.com/app/geolitecountry
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 07-14-2008, 06:05 AM Re: using string functions
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
WTF? Third byte of the IP address definitely does not correlate with the country. Use apache's mod_geoip.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 07-15-2008, 10:24 PM Re: using string functions
Experienced Talker

Posts: 43
Name: Juan Pablo Villaverde
Trades: 0
The IP address block are managed by ARIN (do a google search..), the numeric value have no correlation with country. You need to use geoip. Check ARIN to learn more about the IP address blocks.
__________________
Omnisciens -
Please login or register to view this content. Registration is FREE
software development

Please login or register to view this content. Registration is FREE
jpablo is offline
Reply With Quote
View Public Profile Visit jpablo's homepage!
 
Reply     « Reply to using string functions
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13015 seconds with 12 queries