Deliverable 4 - HTTP/2 Detection

Deliverable 4 - HTTP/2 Detection

Description: Implementing a PHP program which attempts to connect to a server and fetches the protocol that gets negotiated by both client and server to be used for their further communication.

Step - 1: Creating a socket for communication

In this step, a TCP/IP socket is created using PHP's socket functions to establish communication between the client and the server.

Step - 2: Connecting to the server

Once the socket is created, connection can be attempted to the server using the socket_connect() function in PHP. This step either establishes the connection between the client and the server, or displays the error in connecting to the server.

Step - 3: Fetching the negotiated protocol

After successfully connecting to the server, the negotiated protocol is extracted from the handshake protocol packets exchanged between the client and the server. This involves sending a request to the server and capturing the protocol information exchanged during the handshake process.

Results

Result Page Screenshot

Find the full code below:

DetectingH2.php.zip