Return test in an API

Asked

Viewed 91 times

2

I’m testing a way to get data from a database with a simple API, I don’t know if it’s right, if you can give me a hand

I wanted it to work via POST, but the tests on POSTMAN only returns if I put REQUEST

header('Content-type: application/json');

$chave_de_acesso = "teste";

 if($_POST['chave_de_acesso'] == $chave_de_acesso){    

        $array = array(
                "acesso" => 'ok'
        );   

   } else {

            $array = array(
              "acesso" => 'erro'
            );   

   }

echo  json_encode($array);
  • In this case, only returns by REQUEST if you are using $_GET right? Or by $_POST also gives nothing?

  • 1

    @Cypherpotato, By the POST there is nothing, only when I put REQUEST, but I continue with the POST Method

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.