[ 'follow_location' => 0, 'header' => "Host: {$hostHeader}\r\nX-Forwarded-Proto: {$scheme}\r\n", 'ignore_errors' => true, 'max_redirects' => 0, 'timeout' => 3, ], ]); $response = @file_get_contents('http://127.0.0.1/wp-login.php', false, $context); if ($response === false || empty($http_response_header[0])) { exit(1); } if (!preg_match('/\s([0-9]{3})\s/', $http_response_header[0], $matches)) { exit(1); } $status = (int) $matches[1]; exit($status >= 200 && $status < 400 ? 0 : 1);