|
2. Our server receives that content
In our first article, we saw how the browser bundled up the text you wanted to change and put together a full address. So what happens next? Well, read on...
- Well, first up, your browser will do a bit more work. It will separate out the website domain name - in this case, thevoicesofmany.com - and consult what is called a root server to work out which computer or network in the world holds the information requested. It's actually quite involved, but basically by the miracle that is DNS and root servers, your computer and ISP will find out which computer in the world that holds thevoicesofmany.com. It goes through several steps, most of which I don't actually know (I just know that it works!)
- Once the right computer is found, the server starts to do some work. Basically, the server is now given a request to handle. The domain name has been removed, all it really has to worry about is the latter part - in our example, this was /text.php?voice=binary&text=Hello+world%21. They all start with a / sign, to denote that we are working from the very top of the tree. For example, this page you're reading now is /about/howitworks/text2.php, denoting that it starts off at the top, goes down into the about directory, then into howitworks and there it should find text2.php, which it did if you're reading this!
- The server knows that ? means the end of the page itself, so it knows that it is looking for text.php in the top level directory, and that it needs to work with this page. The server also knows that anything ending in .php needs to be passed across to the PHP system before sending it anywhere.
- Before it passes control over to the PHP system to sort out what it has to do with text.php, the server sets up two pigeonholes (remember, these are really called variables), one called text and one called voice, and puts the appropriate information into them, ready for text.php to do its magic.
- Once that's all done, control is passed from the server to the PHP system, to run the instructions contained in text.php, which will instruct the PHP system in what content to produce (and what to do with voice and text as we have been given)
At this point, it could be said that the server has received the content. It's not strictly accurate, because we haven't checked it. So, before we move on to actually doing the cool stuff, we have to check a couple of things:
- Was some text supplied? (We're not checking how much, but as long as there is something there.)
- Was a valid voice supplied? Only methods of modification (voices) that are in the drop-down list are actually valid, even if they are available for webpages, they might not be for normal text (they should be, though!) and only those which support text modifications will be listed in the little drop-down box.
Assuming that both of those checks are successful, we move on to part 3 where the cool stuff happens. Failing that, we drop back with a message saying what was wrong. Maybe you'll have forgotten to set up which voice you wanted (easy enough mistake to make, I know), or forgot to put the text in. Either way, you'll be reminded soon enough.
|
|
|