Created
September 30, 2019 07:29
-
-
Save samuelwilliams/8d49108c1728d67879eebf1e03cfb17b to your computer and use it in GitHub Desktop.
Badcow DNS Parse Comments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Badcow\DNS\Parser\Parser; | |
use Badcow\DNS\ZoneBuilder; | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
$example = <<< 'DNS' | |
$ORIGIN example.com. | |
$TTL 1337 | |
$INCLUDE hq.example.com.txt | |
@ IN SOA ( | |
example.com. ; MNAME | |
post.example.com. ; RNAME | |
2014110501 ; SERIAL | |
3600 ; REFRESH | |
14400 ; RETRY | |
604800 ; EXPIRE | |
3600 ; MINIMUM | |
); This is my Start of Authority Record; AKA SOA. | |
; NS RECORDS | |
@ NS ns1.nameserver.com. | |
@ NS ns2.nameserver.com. | |
info TXT "This is some additional \"information\"" | |
; A RECORDS | |
sub.domain A 192.168.1.42 ; This is a local ip. | |
; AAAA RECORDS | |
ipv6.domain AAAA ::1 ; This is an IPv6 domain. | |
; MX RECORDS | |
@ MX 10 mail-gw1.example.net. | |
@ MX 20 mail-gw2.example.net. | |
@ MX 30 mail-gw3.example.net. | |
mail IN TXT "THIS IS SOME TEXT; WITH A SEMICOLON" | |
DNS; | |
//Parser::parse(string $name, string $zone, bool $retainComments = false): Zone | |
$zone = Parser::parse('example.com.', $example, true); | |
echo ZoneBuilder::build($zone); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment