Search code examples
phppostrequestpostman

Postman request to PHP using POST


This is my code:

<?php
    if(isset($_POST["test"]))
        echo $_POST["test"];
    if(isset($_GET["test"]))
        echo $_GET["test"];
?>

My question is: why POST request doesn't work?

I have tried different parameters in the body and the header and nothing works.

GET request in Postman works: GET request Postman

POST request in Postman fails: POST request Postman


Solution

  • <?php 
      $name = $_POST['name'];
      echo $name;
    ?>