Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <?php
  2.  
  3. use Badcow\DNS\Parser\Parser;
  4. use Badcow\DNS\ZoneBuilder;
  5.  
  6. require_once __DIR__ . '/../vendor/autoload.php';
  7.  
  8. $example = <<< 'DNS'
  9. $ORIGIN example.com.
  10. $TTL 1337
  11. $INCLUDE hq.example.com.txt
  12. @ IN SOA (
  13. example.com. ; MNAME
  14. post.example.com. ; RNAME
  15. 2014110501 ; SERIAL
  16. 3600 ; REFRESH
  17. 14400 ; RETRY
  18. 604800 ; EXPIRE
  19. 3600 ; MINIMUM
  20. ); This is my Start of Authority Record; AKA SOA.
  21.  
  22. ; NS RECORDS
  23. @ NS ns1.nameserver.com.
  24. @ NS ns2.nameserver.com.
  25.  
  26. info TXT "This is some additional \"information\""
  27.  
  28. ; A RECORDS
  29. sub.domain A 192.168.1.42 ; This is a local ip.
  30.  
  31. ; AAAA RECORDS
  32. ipv6.domain AAAA ::1 ; This is an IPv6 domain.
  33.  
  34. ; MX RECORDS
  35. @ MX 10 mail-gw1.example.net.
  36. @ MX 20 mail-gw2.example.net.
  37. @ MX 30 mail-gw3.example.net.
  38.  
  39. mail IN TXT "THIS IS SOME TEXT; WITH A SEMICOLON"
  40. DNS;
  41.  
  42. //Parser::parse(string $name, string $zone, bool $retainComments = false): Zone
  43. $zone = Parser::parse('example.com.', $example, true);
  44.  
  45. echo ZoneBuilder::build($zone);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement