couldn't resolve host
Found a Curl error:
couldn't resolve host 'domain.name'
It seemed that Curl was trying to resolve the domain name, but failed to do it. My first guess is that it's a permission issue of httpd, like ACL.
Let's check SELinux boolean value of httpd.
[root@www ~]# getsebool -a | grep httpd
...
httpd_can_network_connect --> off
...
Solution
There is a suspect permission called httpd_can_network_connect in the list, which could be the key to the problem.
Let's enable the permission.
[root@www ~]# setsebool -P httpd_can_network_connect on
[root@www ~]# getsebool -a | grep httpd
...
httpd_can_network_connect --> on
...
Don't forget to restart httpd after enabling.
[root@web ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
Then, try the PHP code again, it's back to normal.
If you have already enabled httpd_can_network_connect, restarting httpd service might be helpful.