Claudio Corlatti wrote:
On 14 jul, 17:21, Michael Fesser <neti...@gmx.dewrote:
>.oO(Sudhakar)
>>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.
This can't be done reliably, not even with GeoIP databases. An IP is not
bound to any particular country nor does it say anything about where the
user is actually. All you can get are informations about the company the
IP belongs to.
>>i
believe by using the third set of numbers (in this case=190) from an
ip address we can find out the country name.
Where did you get that from? It's totally wrong. There's absolutely no
country information contained in an IP address, it's just an unsigned
32bit number (in case of IPv4).
Micha
well, maybe you can't obtain one hundred percent reliable data about
the country, not even when you ask to the user, but with the ip you
can at least try to guess, better than nothing don't you think?
Actually its probably a lot better than a guess, since you normally
apply to the organisation in the country in which you are operating, for
an IP address range.
e.g.
#whois 86.30.134.0
OrgName: RIPE Network Coordination Centre
OrgID: RIPE
Address: P.O. Box 10096
City: Amsterdam
StateProv:
PostalCode: 1001EB
Country: NL
ReferralServer: whois://whois.ripe.net:43
NetRange: 86.0.0.0 - 86.255.255.255
CIDR: 86.0.0.0/8
NetName: 86-RIPE
NetHandle: NET-86-0-0-0-1
Parent:
NetType: Allocated to RIPE NCC
NameServer: NS-PRI.RIPE.NET
NameServer: NS3.NIC.FR
NameServer: SEC1.APNIC.NET
NameServer: SEC3.APNIC.NET
NameServer: SUNIC.SUNET.SE
NameServer: TINNIE.ARIN.NET
NameServer: NS.LACNIC.NET
Comment: These addresses have been further assigned to users in
Comment: the RIPE NCC region. Contact information can be found in
Comment: the RIPE database at
http://www.ripe.net/whois
RegDate: 2004-04-01
Updated: 2004-04-06
# ARIN WHOIS database, last updated 2008-07-14 19:10
# Enter ? for additional hints on searching ARIN's WHOIS database.
% This is the RIPE Whois query server #3.
% The objects are in RPSL format.
%
% Rights restricted by copyright.
% See
http://www.ripe.net/db/copyright.html
% Note: This output has been filtered.
% To receive output for a database update, use the "-B" flag.
% Information related to '86.30.0.0 - 86.30.255.255'
inetnum: 86.30.0.0 - 86.30.255.255
netname: NTL
descr: NTL Infrastructure - NTL Freedom
country: GB
admin-c: NNMC1-RIPE
tech-c: NNMC1-RIPE
status: ASSIGNED PA
mnt-by: AS5089-MNT
source: RIPE # Filtered
role: NTLI Network Management Centre
address: NTL Internet
address: Crawley Court
address: Winchester
address: Hampshire
address: SO21 2QA
phone: +44 1633710142
admin-c: MH22007-RIPE
admin-c: NR731-RIPE
admin-c: CW1083-RIPE
tech-c: MH22007-RIPE
tech-c: CW1083-RIPE
nic-hdl: NNMC1-RIPE
mnt-by: AS5089-MNT
e-mail:
pi*@virginmedia.co.uk
source: RIPE # Filtered
% Information related to '86.0.0.0/11AS5089'
route: 86.0.0.0/11
descr: NTL-UK-IP-BLOCK
origin: AS5089
mnt-by: AS5089-MNT
remarks: report abuse to
www.virginmedia.com/netreport +44
(0)1633 710142
source: RIPE # Filtered