Skip to content

Instantly share code, notes, and snippets.

@zQueal
Created July 25, 2014 23:49
Show Gist options
  • Select an option

  • Save zQueal/50de9d076bf2a298525d to your computer and use it in GitHub Desktop.

Select an option

Save zQueal/50de9d076bf2a298525d to your computer and use it in GitHub Desktop.
Return DNS records for a domain.
#!/usr/bin/env php
<?php
class DNS {
public function __construct() {
$q = $_SERVER['argv'];
if(isset($q[1])) {
$lookup = dns_get_record($q[1], DNS_ALL - DNS_PTR);
echo json_encode($lookup);
} else {
echo "You must chose a hostname!".PHP_EOL;
echo "Usage: php -f dns.php www.google.com".PHP_EOL;
}
}
}
new DNS;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment