Home  »  CodeSnippets   »   Check if is GET Request in PHP

Check if is GET Request in PHP

Posted: February 7, 2022 | by Michael Bright

Use the $_SERVER built-in global variable:

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // your code here
}

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.