Jump to content

using string functions


sudhakararaog

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/114633-using-string-functions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.