Skip to content

Instantly share code, notes, and snippets.

@Timi7007
Last active March 27, 2018 14:25
Show Gist options
  • Save Timi7007/b15db3f62cdefdb81f8762c3a92ee193 to your computer and use it in GitHub Desktop.
Save Timi7007/b15db3f62cdefdb81f8762c3a92ee193 to your computer and use it in GitHub Desktop.
Simple test for DNS CAA-records in PHP. CLI/Browser cross-compatible.
<?php
if (php_sapi_name() == 'cli') {
$host = $argv['1'];
}
elseif (php_sapi_name() !== 'cli') {
echo '<pre>';
$host = $_GET['input'];
}
$records = dns_get_record($host, DNS_CAA);
foreach ($records as $record) {
echo $record['host'];
echo " ";
echo $record['type'];
echo " ";
echo $record['flags'];
echo " ";
echo $record['tag'];
echo " ";
echo $record['value'];
echo "\n";
}
//var_dump($records); // Uncomment for complete output as array. Use to debug.
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment