5

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?

Sebastian Hoitz
  • 9,343
  • 13
  • 61
  • 77

1 Answers1

2

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.

tobyS
  • 860
  • 1
  • 7
  • 15