How can I check if the Content-type of a POST request in PHP is either application/json or application/x-www-form-urlencoded?
I've tried using $_SERVER["CONTENT_TYPE"]
and echo get_headers('url', 1)["Content-Type"]
but neither of those work for me.
echo '<pre>';
print_r(getallheaders());
So
$allHeaders = getallheaders();
$contentType = $allHeaders['Content-Type'];