mirror of
https://github.com/danog/dns.git
synced 2024-11-30 04:29:06 +01:00
23 lines
664 B
PHP
23 lines
664 B
PHP
<?php
|
|
|
|
use Amp\Dns\Record;
|
|
|
|
require __DIR__ . "/../vendor/autoload.php";
|
|
|
|
function pretty_print_records(string $queryName, array $records)
|
|
{
|
|
print "---------- " . $queryName . " " . str_repeat("-", 55 - strlen($queryName)) . " TTL --\r\n";
|
|
|
|
$format = "%-10s %-56s %-5d\r\n";
|
|
|
|
foreach ($records as $record) {
|
|
print sprintf($format, Record::getName($record->getType()), $record->getValue(), $record->getTtl());
|
|
}
|
|
}
|
|
|
|
function pretty_print_error(string $queryName, \Throwable $error)
|
|
{
|
|
print "-- " . $queryName . " " . str_repeat("-", 70 - strlen($queryName)) . "\r\n";
|
|
print get_class($error) . ": " . $error->getMessage() . "\r\n";
|
|
}
|