URL to IP conversion
Moderator: General Moderators
URL to IP conversion
Is there a way I can convert a url to an IP?
Ex:
I enter:
http://www.google.com
Script returns:
64.233.161.104
Thanks,
Zanne
Ex:
I enter:
http://www.google.com
Script returns:
64.233.161.104
Thanks,
Zanne
Re: URL to IP conversion
Thank you once again. The code works fine =)
Re: URL to IP conversion
how about the visitors IP?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: URL to IP conversion
arborint thanks for the reply.arborint wrote:$_SERVER["REMOTE_ADDR"]
but why it is different with the actual Visitors IP?
I echo $_SERVER["REMOTE_ADDR"] the result is xxx.x.x.x
example 123.0.0.0 but the actual Visitor IP is 192.168.xxx.xxx
is this accurate? and Please explain thanks.
Re: URL to IP conversion
The 192.168.xxx.xxx is the network IP address assigned to the computer. However, what the server sees is the DNS address. to obtain the actual Visitor's IP address, try going to this link: http://www.whatsmyrealip.commhonnphp wrote:arborint thanks for the reply.arborint wrote:$_SERVER["REMOTE_ADDR"]
but why it is different with the actual Visitors IP?
I echo $_SERVER["REMOTE_ADDR"] the result is xxx.x.x.x
example 123.0.0.0 but the actual Visitor IP is 192.168.xxx.xxx
is this accurate? and Please explain thanks.
That link will tell you your actuall IP address the server will see and recognize.
Re: URL to IP conversion
Ah ok, then how can I get the real IP?Zanne wrote:The 192.168.xxx.xxx is the network IP address assigned to the computer. However, what the server sees is the DNS address. to obtain the actual Visitor's IP address, try going to this link: http://www.whatsmyrealip.commhonnphp wrote:arborint thanks for the reply.arborint wrote:$_SERVER["REMOTE_ADDR"]
but why it is different with the actual Visitors IP?
I echo $_SERVER["REMOTE_ADDR"] the result is xxx.x.x.x
example 123.0.0.0 but the actual Visitor IP is 192.168.xxx.xxx
is this accurate? and Please explain thanks.
That link will tell you your actuall IP address the server will see and recognize.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: URL to IP conversion
You can't - if you're on a network with a router then your IP is masked. It doesn't really matter though, because your "real IP" only means something on your local network anyway.