Re: using string functions

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

 



Hi Sudhakar,

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

In your case, the value 190 is kept in $ipaddress[2].

And follow the URL for IP Address range for all countries:
http://ip-to-country.webhosting.info/book/print/5

Bye

 Thanks & Regards
Udayakumar Sarangapani
Sr. PHP Developer
CompIndia Infotech Pvt. Ltd.
Chennai.

"Science is nothing but logic..."




----- Original Message ----
From: Sudhakar <finals27@xxxxxxxxx>
To: php-objects@xxxxxxxxxxxxxxx
Sent: Monday, 14 July, 2008 2:05:16 PM
Subject:  using string functions


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..

    


      Best Jokes, Best Friends, Best Food and more. Go to http://in.promos.yahoo.com/groups/bestofyahoo/

[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