Re: using string functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



    $ip=explode(".",$_SERVER['REMOTE_ADDR']);
    print_r($ip);

the $ip[2] will be the third set of numbers.

Sudhakar wrote:
>
> 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.
>
>  



[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux