Specifications

<form method=post action=”directory_submit.php”>
URL: <input type=text name=”url” size=30 value=”http://”><br>
Email contact: <input type=text name=”email” size=23><br>
<input type=”submit” name=”Submit site”>
</form>
</body>
</html>
This is a very simple formthe rendered version, with some sample data entered, is shown in
Figure 17.2.
Using Network and Protocol Functions
C
HAPTER 17
17
USING NETWORK
AND
PROTOCOL
FUNCTIONS
375
LISTING 17.2 Continued
FIGURE 17.2
Directory submissions typically require your URL and some contact details so directory administrators can notify you
when your site is added to the directory.
When the submit button is pressed, we want to check, first, that the URL is hosted on a real
machine, and, second, that the host part of the email address is also on a real machine. We
have written a script to check these things, and the output is shown in Figure 17.3.
FIGURE 17.3
This version of the script displays the results of checking the hostnames for the URL and email addressa production
version might not display these results, but it is interesting to see the information returned from our checks.
22 7842 CH17 3/6/01 3:39 PM Page 375