WordPress wp_remote_post() gives "cURL error 6: Could not resolve host"

Since this morning some function in a wordpress site I’m managing is not working anymore. I syslogged the response from it, which gives me:

{"errors":{"http_request_failed":["cURL error 6: Could not resolve host: subdomain.example.com"]},"error_data":[]}

When I manually run curl from that machine I simply get the html as a response. Since it says it could not resolve the host, I presume the problem occurs before the domain name can be resolved to an ip. So I guess (but not sure) this has something to do with the DNS.

I really don’t understand what could be wrong here or how I can debug this. Does anybody have a suggestion?

All tips are welcome!

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

as mentioned here and due to this USN:

you will may need to update your dist

sudo apt-get update
sudo apt-get dist-upgrade

this fixed my issue with curl


you will need to be aware of the dist-upgrade step, some packages –such as php– during the updrage will prompt you to ask you wether you want to replace the configuration files , you must be very aware of what you are doing here , keeping those files or replacing with the new -default- files.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply