أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
<p style="text-align:left;"><span>For more details please see the </span><a href="http://php.net/manual/en/reserved.variables.server.php">documentation for the $_SERVER variable</a><span>.</span></p>
I think you should use use the variable $_SERVER['REQUEST_METHOD']
$_SERVER variable will let you know that which type of request you are getting. e.g
By using $_SERVER['REQUEST_METHOD']
For further details please see the documentation of $_SERVER variable .
using $_SERVER['REQUEST_METHOD'] you can detect which type of request