I haven't found a way to get cURL error code so far. When using EasyInit, it's returning error message string like curl: Couldn't resolve host name.
func main() {
easy := curl.EasyInit()
defer easy.Cleanup()
easy.Setopt(curl.OPT_URL, "http://zzzzzzzz---.com")
if err := easy.Perform(); err != nil {
fmt.Println(err, err.Error())
}
}
But, how to get the cURL error code like the libcurl equivalent returns.
int main(int argc, char *argv[]) {
CURL *easyhandle = curl_easy_init();
curl_easy_setopt(easyhandle, CURLOPT_URL, "http://zzzzzzzz---.com");
int errorCode = curl_easy_perform(easyhandle);
printf("Error Code: %d %d\n", errorCode, errorCode == CURLE_COULDNT_RESOLVE_HOST);
return 0;
}
I haven't found a way to get cURL error code so far. When using
EasyInit, it's returning error message string likecurl: Couldn't resolve host name.But, how to get the cURL error code like the
libcurlequivalent returns.