CURL & HTTP Couldn't Resolve Host

The error message "can't resolve host" is caused by a problem with domain name service lookup. Every named Internet address must be resolved using domain name service to determine where on the Internet to route the request. When this address cannot be found, cURL reports the "can't resolve host" error.

Instructions

    • 1

      Double-check the spelling of the URL you are attempting to reach using cURL. An error in the spelling, such as ww.domain.com instead of www.domain.com, can cause DNS resolution failure.

    • 2

      Use cURL to attempt to reach a test website to see if that can be reached. For example, try "curl http://www.google.com." Google is a good site to use as it is unlikely to be offline. A failure to connect indicates that you have a local problem with domain name resolution or your Internet connection. A successful connection to your test website may indicate that the problem is with the original website you are trying to reach.

    • 3

      Open your Internet settings, also called TCP/IP settings on some operating systems, to determine whether you have successfully been assigned a DNS server. Internet settings are typically stored under a Network icon in your control panels or system preferences. A DNS server should be listed under your Internet connection.

    • 4

      Replace the assigned DNS server with a public DNS server to determine whether an alternate DNS lookup fixes the problem. You can enter the Google Public DNS addresses of 8.8.8.8 and 4.4.4.4, or the OpenDNS public addresses of 208.67.222.222 and 208.67.220.220. Try the cURL command again.

    • 5

      Restart your computer if the problem persists, as this will resolve many of the remaining problems that could be interfering with your cURL command. If this does not resolve your problem but other Internet connections work on your computer, the problem is likely to be with your Internet connection and must be resolved by your system administrator on a work connection, or your Internet service provider on a home connection.

Related Searches:

References

Comments

Related Ads

Featured