Does anyone know how to setup a server to listen for a Domain Name Server change from registrar. For example if someone was to purchase a domain and point it to my server NS1.MyServer.comNS2.myserver.com my server would be ping of this request and from there i can run a php script.
I know its possible; the last job i worked at the linux admin set it up; which i thought was the coolest technique I would love to learn.
There’s no generic API that tells you when someone has pointed their nameservers at your server.
But there are two ways you can discover that information without anybody notifying (“pinging”) you:
If someone’s pointed their nameservers to you, and then someone tries to access that domain in any software, it’s going to result in your name server getting a DNS query to resolve the domain. Hook into your local nameserver somehow (depends on what DNS daemon you run) and you’ll know about new domains you’re being queried for. Do your own DNS lookup to find out if you’re listed as authoritative for those domains.
Get access to the .COM, .NET, .ORG etc. root zone files. This is harder, since AFAIK it’s only given out with permission by the companies that run those registries. If you can get access, you can poll the file for new domains listing your server as their nameserver.