Q&A

Q1: HTTP seems a little esoteric. Do I really need to know about it to write good PHP code?
A1: No. You can write excellent code with knowing the intricacies of client/server interaction. On the other hand, a basic understanding of the process is useful if you want to do more than just download pages from remote servers.
Q2: If I can send fake headers to a remote server, how suspicious should I be of environment variables myself?
A2: You should not trust environment variables such as $_SERVER['HTTP_REFERER'] and $_SERVER['HTTP_USER_AGENT'] if their accuracy is essential to the operation of your script. Remember, though, that the vast majority of clients you deal with will tell you the truth. If you are merely ensuring a productive user ...

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.