All webservers including Apache, Nginx, IIS, etc log each request's http status code. I'm trying to understand how to get the Http status code from instrumentation, not from the logs. Is there a way?
1 Answer
I don't know if it's what you asking for, the word "instrumentation" is a little ambiguous, but you can simply use this PHP funtion :
echo http_response_code();.
It will return you the current status code as an integer, you can push this value in an array every time a page is load so you have editable logs.