Answers to Chapter 15

  1. "What are the advantages of fsockopen() over fopen() for use with HTTP connections" The former gives up much more control: not only can we choose a different HTTP port (such as 8000, or 8080), but we can also send different types of request through.

  2. "Which function can be used to make a script instruct visitors to redirect to another URL" The answer is "d", header().

  3. "Using Apache, what filename is used to specify authorisation is required" The answer is ".htaccess", but be wary - using .htaccess files requires enabling the module mod_access, which is very slow!

 

Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: Answers to Chapter 16 >>

Previous chapter: Answers to Chapter 14

Jump to:

 

Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.