Is there a possibility to create a REST API in PHP that supports ETags?
And if yes, how could you use parse the response in PHP to consider the ETags?
You can find the corresponding request headers in $_SERVER
If-Match
. Is the key HTTP_IF_MATCH
, If-None-Match
corresponds to HTTP_IF_NONE_MATCH
.
In order to send proper ETags to the client use the ETag
header like header( 'ETag: ' . generateEtag() );
. You just need to ensure that your ETag represents the response of the service properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With