I tried to send the following POST request to https://myurl.com/directoryname in JSON format:
{
"username": "test",
"password": "test2"
}
And the index.php file on my server has the following to debug:
var_dump($_SERVER['REQUEST_METHOD']);
$raw_data = file_get_contents('php://input');
$data = json_decode($raw_data);
But when I try to var_dump() and echo these variables, I got:
request method: string(3) "GET"
raw_data: string(0) ""
data: NULL
There does not seem to be any problem with these codes in PHP, so I assume the problem must be in the way that I send this request.