I am creating domains using WHM Cpanel API and everything is working fine. Domain are being created properly. My issue is when I try to do a curl request on the new domain it does not work. So I then add the new domain name in /etc/hosts file and then the CURL starts working for that domain.
For example I created www.newdomain.info
through API and everything goes fine and the website is also running fine. I want to make some changes through curl to www.newdomain.com
. The curl does not work. After I add it to /etc/hosts
file the curl work fine.
I add this line to hosts file to make curl work
192.162.0.5 newdomain.info www.newdomain.info
My issue is I cannot keep on adding these lines everytime a new domain is created. May be in a single day 100's of websites can be created. I want a way so that PHP CURL works on all domains on a server. May be by adding some line in hosts file??