Check whether a request is GET or POST 
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/359047/php-detecting-request-type-get-post-put-or-delete">PHP detecting request type (GET, POST, PUT or DELETE)</a>  </p>
</blockquote>



<p>This should be an easy one.</p>

<p>I have a script, and in the script I want to determine whether the request arrive via <code>GET</code> or <code>POST</code> method. </p>

<p>What is the correct way to do it?</p>

<p>I am thinking of using something like this</p>

<pre><code>if (isset($_POST)) {
    // do post
} else  {
    // do get
}
</code></pre>

<p>But deep in my heart I don't feel this is the right way. Any idea?</p>
