Running this code i get an error "curl_easy_perform() failed: SSL peer certificate or SSH remote key was not OK"
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL* curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
/* First set the URL that is about to receive our POST. This URL can
just as well be a https:// URL if that is what should receive the
data. */
curl_easy_setopt(curl, CURLOPT_URL, "https://www.quandl.com/api/v3/datasets/WIKI/FB/data.json?api_key=MY-CODE-HERE");
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
if (res != CURLE_OK)
{
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
}
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
There is an example on the quandl website using this exact GET request. It is using the curl.exe though but i dont think it has got anything to do with this.
No where on the quandl website does it mention how to get a certificate or key so my initial thoughts is that they dont allow using libcurl directly OR curl.exe retrieves some certificates from the quandl server.
I tried google.com also and got the same error.
Anyone come across this?
EDIT
I do not want to by-pass SSL verification.
I found out you need to download the .pem file here https://curl.haxx.se/docs/caextract.html
And add these settings...
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYSTATUS, 1);
curl_easy_setopt(curl, CURLOPT_CAINFO, "PATH TO FILE\\cacert.pem");
curl_easy_setopt(curl, CURLOPT_CAPATH, "PATH TO FILE\\cacert.pem");