OK, a coulple of basic things first. If I am "teaching you how to suck eggs", then my apologies.
Firstly, a URL consists up up to four components. Take this as an example:
http://www.dummyurl.com.au/directory/index.html?question=how
The parts are: (these are my own names - there is probably the "official" ones in an RFC somewhere)
- Protocol - the "http:" section. You can also see URL's starting with "ftp:" or "telnet:" and so on. This means we will use http as the transfer protocol.
- host and domain name - the "www.dummyurl.com.au". Somewhere there is a domain name "dummyurl.com.au". If you have access to a unix shell account, try nslookup. Read up about DNS - the Domain Name Service - that translates names to addresses. The "www" is a host connected to that domain, and has been the default web server host name. It doesn't have to be that tho.
- The file name - directory/index.html. Starting at the web server's "document root" directory, there will be a subdirectory "directory" containing a file "index.html". This is the html document that is returned to you.
- cgi "get" paramaters - the bit ?question=how. These are values that a "get" request will pass to a cgi program.
Now, there are much more detailed and complete descriptions of URLs that that, but I think you get the picture. So what you are wanting to do is to turn the domain name part in to its corresponding ip address. There are modules that can do that - Net::DNS is your friend here.
One question though is - why? Why do you need to know that "yahoo.com" has an ip address of 10.10.10.10? That may very well change tomorrow, but the name will remain (relatively) constant.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.