I have a personal project that I'd like to start working on, but I'm a little stuck on a potential feature that I'd like to add.
Basically, I want to provide a service online that allows people to add their domain name, and IP address and preview their website before their DNS has updated. Just like what you would do if you updated the hosts file on your own machine.
Does anything know how I could go about doing this? All I can think of is that I have PHP write to /etc/hosts file, but that doesn't seem quite right.
You need to run a wildcard DNS server that points subdomains on the fly. Not sure it's really possible with PHP but you can use what xip.io uses: https://github.com/basecamp/xip-pdns
Both of these would hit the same IP address, but retrieve different sites hosted on them as you're specifying the host (you can run the above on the command line to see what I mean for quick reference).
Maybe this is one method of doing it?
Building an entire application around this concept is a bit too involved for a reply here however.
Cheers for the info guys. It doesn't have to be PHP, but I'll use PHP for the client facing application so if it's possible with PHP then I'll go with that.. I'll look into it a little more, but I suspect both solutions would work, but would imagine a DNS server would be best.