Exercises

  1. Create a script that accepts a Web hostname (such as http://www.microsoft.com) from user input. Send the host a HEAD request using fsockopen() to create the connection. Print the response to the browser. Remember to handle the possibility that no connection can be established.

  2. Create a script that accepts a message from the user and mails it to you. Add server variables to the user’s message to tell you about her browser and IP address.

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.