I've created an HTTP Proxy with PHP. It works well for simple HTTP requests where it receives the request, passes it to the target, passes the target's response to the client and closes the connection.
But in the case of TLS requests, when a client sends a CONNECT
request, I don't have any idea how can I keep the connection alive and simply create a tunnel which can transfer all the data in two directions.
Are any low level works needed? Or should I use something like a socket connection? If so, how can I do it in PHP?