I have not been able to find a definitive answer for this, so I figured I would ask here. Is there any way of using PHP to essentially resolve to an IP based on sub-domain? I would use PHP header(), but the issue is that the IPs will not all be going towards web-servers. To better explain, I will give an example:
Client goes to s1.server.com and should be directed to 10.10.10.10
Client goes to s2.server.com and should be directed to 184.108.40.206
If possible, I would also like to be able to specify port, so something such as:
Client goes to s3.server.com and should be directed to 220.127.116.11:8080
I understand you can do all of this with the web engine (Apache, Nginx, etc) or by adding in multiple DNS entries for the subdomains. My problem is that I need a system that is very dynamic (DNS and engine entries need to be added in manually) and in the end I want something that will end up using a PHP script to look up IPs in a MySQL database based on what sub-domain is used.
Is anything like this possible? If yes, how would I go about doing so? If not, am I stuck using DNS or specific engine configurations in order to accomplish this?