$url = 'https://www.example.com';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_exec($ch);
$result = curl_exec($ch);
curl_close($ch);
$lcHeaders = [];
$trim_result = rtrim($result);
$lcData = explode("\n", $trim_result);
$lcHeaders['status:'] = $lcData[0];
array_shift($lcData);
foreach ($lcData as $lcPart) {
$lcMiddle = explode(":", $lcPart, 2);
if (!isset($lcMiddle[1])) {
$lcMiddle[1] = null;
}
$lcHeaders[trim($lcMiddle[0])] = trim($lcMiddle[1]);
}
if (isset($lcHeaders["Server"]) && $lcHeaders["Server"] == 'LiteSpeed') {
echo 'LiteSpeed webserver is running';
}