packetie
packetie

Reputation: 5069

php handle 2 requests coming through the same TCP connection

I would like to write a simple php script to handle the situation where two HTTP requests coming through the same TCP connection. More specifically, would like to respond to a request differently if it comes in a tcp connection that has completed a HTTP transaction (vs a tcp connection that has never had any HTTP transaction).

This may be against the principle of php/apache, just curious if there is a way to do it.

Thanks in advance.

Upvotes: 1

Views: 53

Answers (1)

packetie
packetie

Reputation: 5069

A php script can use the following to distinguish connections that carry the HTTP requests.

$_SERVER["REMOTE_ADDR"]:$_SERVER["REMOTE_PORT"]

Upvotes: 1

Related Questions