So I'm trying to grasp the basics of how to make/use an API. So I have a bit of code that should check if the name is what is should be, then return a 1
or 0
. So here's the code
$name = $_POST['name'];
//Set array
$status = array();
if(isset($name) || $name = "Bob"){
$status['success'] = 1;
echo json_encode($status);
}
else{
$status['success'] = 0;
echo json_encode($status);
}
Then I hop over to PostMan to send the POST, I do
http://localhost/index.php?name=Bob
But all I end up getting is
( ! ) Notice: Undefined index: name in /Users/matt/Dropbox/API Server/index.php on line 3
Line 3 turns out to be $name = $_POST['name'];
. Any help would be great