Skip to content

Instantly share code, notes, and snippets.

@bmcculley
Created October 14, 2022 02:13
Show Gist options
  • Save bmcculley/978ff1118a653cf7ada442f84b87ae5f to your computer and use it in GitHub Desktop.
Save bmcculley/978ff1118a653cf7ada442f84b87ae5f to your computer and use it in GitHub Desktop.
An example of how to get MX records for a domain.
<?php
$records = dns_get_record("abc.xyz", DNS_MX);
foreach ($records as $rec) {
print($rec['host']."\n");
print($rec['type']."\n");
print($rec['pri']."\n");
print($rec['target']."\n");
print($rec['class']."\n");
print($rec['ttl']."\n");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment