1 year ago
#366415
SherazKamran
Code on WHM Server Keeps on Sending 'HTTP/1.1 200 OK' on every response
I'm returning different responses (and HTTP status codes) using header function for different outcomes in my code. The code seems to work perfectly fine in localhost and sends HTTP codes accordingly but keeps on returning 'HTTP/1.1 200 OK' from WHM Server for every other outcome.
To make it more clear, I'm sharing a snippet of my code where a response is set and sent once the server receives an empty json packet..
PHP Version : 7.4
My Code:
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server', true, 500);
echo json_encode(array(
"msg" => "no data found"
));
Localhost Response:
WHM Server Response:
WHM Server Response on POSTMAN
Has anyone come across such an issue before? It's been a whole day since I'm searching for a solution but couldn't find any...
php
localhost
http-status-codes
whm
0 Answers
Your Answer