curl-library
CURLE_COULDNT_RESOLVE_HOST
Date: Mon, 02 Mar 2015 09:36:16 -0500
Hello, I am writing because I am experiencing an issue with the curl
easy perform API, I've been trying for awhile to find a solution but
I've exhausted my resources finding anything. I have the following code
in a C++ file I am writing:
CURL *curl;
CURLcode res;
std::string path = "http://mywebsite.com";
curl_easy_setopt(curl, CURLOPT_URL, path);
curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP
| CURLPROTO_HTTPS);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
//curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 1);
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER);
res = curl_easy_perform(curl);
if(res != CURLE_OK)
{
std::cout << "error" << std::endl;
std::cout << "res = '" << res << "'" << std::endl;
return "cURL error";
}
else
{
std::cout << "success" << std::endl;
curl_easy_cleanup(curl);
//continue with processing results...
}
When I attempt to run this, if prints "error" and "res = '6'" which
according to the documentation means it could not resolve the host. I
have tried the path with http, https, and without http:// at the
beginning, as well as using the IPv4 address of the page instead, and
all give the same results. When I run the curl.exe in command prompt
with the https:// version of the address, it works fine, but not in my
code via the API. The only really relevant post I could find online said
that it was probably caused by a CURL bug ,but it was posted over 2
years ago so I'm not sure if it's still a known issue. If you could
please offer any help I'd really appreciate it. Thanks!
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-03-02