How can I get the first line of the servers' HTTP response (Apache2 in my case) for use in my PHP scripts? For example:
HTTP/1.1 200 OK
HTTP/1.1 404 Not Found
Etc.
Or better yet, get just the HTTP response code that my server sends to the client.
To my surprise, $_SERVER doesn't have it. http_response_code() seems to only get the response code if it's first been set by PHP. apache_response_headers() doesn't seem to have it. get_headers() seems like it would require an extra step/connection (correct me if I'm wrong).
If I set ErrorDocument 403 /index.php in httpd.conf, I can use $_SERVER["REDIRECT_STATUS"] to get the response code from PHP, but is there another way?
EDIT:
Just to be clear, I find it odd that $_SERVER returns almost every bit of data except for the first line of the response or the response code. Maybe it's a general limitation between the HTTP protocol/server technology/PHP? Maybe I shouldn't be trying to access this info in my PHP scripts?