Re: IP to URL conversion
- Posted by jimcbrown (admin) Aug 14, 2015
- 2278 views
Not quite. The domain is returned but not the full URL. I see now it's a bit like searching for a street address but the map you have only shows the town name.
I suspect some of the net gurus knew about this as soon as they read the post - but they didn't say anything. That's not very nice.
I considered it when reading your original post, but it seemed pedantic of me to correct you.
I just assumed that the question was to translate an ip address to the root of an HTTP server, e.g. "1.1.1.1" -> "http://www.example.com" since HTTP is probably the most common URL out there. That someone was trying to do a "1.1.1.1" -> "http://www.example.com/more_exapmles.html" conversion didn't occur to me at all.
A URL is composed of the following parts:
The most you're going to get from an IP is the domain. The DNS system has no knowledge of actual URLs.
If even that. But a single IP address is often mapped to multiple domains, so if you get more than one you'll need some other way to figure out which one you want to use.
I suggest reading up on the Wikipedia entry for URL to get a better understanding of what each part means.
-Greg
Also, it's permissible to use the IP address in an URL directly. This is pretty rare on the wider internet, but on a home network I often see "http://192.168.0.1" (or example) to access the web page of a router or something. An IP address doesn't have to be mapped to a domain at all, if you wanted to you could force others to remeber and use the raw ip address to get to your site.