0

I'm developing an API REST and I want my code to distinguise between a GET HTTP HEADER and a DELETE HTTP HEADER for returning the information asked or for removind this info from the database.

Thanks.

Mario
  • 1,321
  • 4
  • 13
  • 23

1 Answers1

0

You can use this:

$_SERVER['REQUEST_METHOD']

Keep in mind that besides PUT and DELETE aren't supported in all browsers and on some server implementations. You can use the Rails way, and pass a _method parameter to a POST/GET call.

yoavmatchulsky
  • 2,912
  • 1
  • 14
  • 22