Answer the question
In order to leave comments, you need to log in
How to find PHP HTTP response code?
In .htaccess
#401 Авторизация не выполнена
ErrorDocument 401 /error.php
#403 Access is denied
ErrorDocument 403 /error.php
#404 Page not found
ErrorDocument 404 /error.php
#500 Внутренняя ошибка сервера
ErrorDocument 500 /error.php
error_reporting(E_ERROR | E_PARSE);
// Initialize a variable into domain name
$domain1 = 'https://contribute.geeksforgeeks.org';
// Function to get HTTP response code
function get_http_response_code($domain1) {
$headers = get_headers($domain1);
return substr($headers[0], 9, 3);
}
// Function call
$get_http_response_code = get_http_response_code($domain1);
// Display the HTTP response code
echo $get_http_response_code;
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question