2

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??

Yunus Aslam
  • 2,447
  • 4
  • 25
  • 39
  • Add you see log for newdomain.com, when ask with curl newdomain.com ? Try tail -f /usr/local/apache/domlogs/ and excesute curl. – abkrim Dec 29 '15 at 09:22

1 Answers1

1

It sounds like DNS isn't resolving for you. In that case you have two options

1) Fix DNS (or wait for it to propagate), 2) echo the domain and IP into the /etc/hosts file as part of your account creation script.

benny
  • 13
  • 2