Skip to content

Instantly share code, notes, and snippets.

@dvygolov
Created April 8, 2024 15:48
Show Gist options
  • Save dvygolov/f6950d61a033072a1bb25e54c7c28cd3 to your computer and use it in GitHub Desktop.
Save dvygolov/f6950d61a033072a1bb25e54c7c28cd3 to your computer and use it in GitHub Desktop.
This script shows how to get real version of Android and other CH headers
<?php
header("Critical-CH: Sec-CH-UA-Full-Version-List,Sec-CH-UA-Mobile,Sec-CH-UA-Platform,Sec-CH-UA-Platform-Version,Sec-CH-UA-Bitness,Sec-CH-UA-Model");
// Extract each of the client hints from the request
$fullVersionList = $_SERVER['HTTP_SEC_CH_UA_FULL_VERSION_LIST'] ?? 'Not provided';
$mobile = $_SERVER['HTTP_SEC_CH_UA_MOBILE'] ?? 'Not provided';
$platform = $_SERVER['HTTP_SEC_CH_UA_PLATFORM'] ?? 'Not provided';
$platformVersion = $_SERVER['HTTP_SEC_CH_UA_PLATFORM_VERSION'] ?? 'Not provided';
$bitness = $_SERVER['HTTP_SEC_CH_UA_BITNESS'] ?? 'Not provided';
$model = $_SERVER['HTTP_SEC_CH_UA_MODEL'] ?? 'Not provided';
$ua = $_SERVER['HTTP_USER_AGENT'];
?>
<html>
<body>
<p>User Agent: <?php echo htmlspecialchars($ua); ?></p>
<p>Full: <?php echo htmlspecialchars($fullVersionList); ?></p>
<p>Mobile: <?php echo htmlspecialchars($mobile); ?></p>
<p>Platform: <?php echo htmlspecialchars($platform); ?></p>
<p>Platform Version: <?php echo htmlspecialchars($platformVersion); ?></p>
<p>Bitness: <?php echo htmlspecialchars($bitness); ?></p>
<p>Model: <?php echo htmlspecialchars($model); ?></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment