// Check auth: if ($_SERVER['PHP_AUTH_USER']){ echo "Authorized"; } else { header('HTTP/1.1 401 Unauthorized'); echo "Unauthorized"; }