Identifying Clients and Servers
When an HTTP transaction occurs, both the client and server involved can identify themselves. Like most identification on the Internet, this is both optional and easy to fake. Identification occurs from the client side by sending a User-agent header that identifies the type of client connecting to the server. Correspondingly, the server sends a Server header to the client.
Even though the client and server identification is optional and can be faked, you will find this identification quite usefulparticularly in the case of the User-agent. The User-agent header allows customized content for different clients. This allows everything from working around bugs in different browsers to enabling more advanced features in particular browsers.
Although the User-agent header is normally sent from browsers to servers, the Server header, at least some of the time, is not sent during the HTTP transaction. This is a security precaution because hiding the server's specific characteristics prevents security exploits tied to a specific server type.
When you are programming PHP, you are generally interested in identifying the User-agent, not the Server (because your program already runs on the server). The standard PHP $_SERVER variable contains the User-agent. You can access it as follows: