Hi guys,
I need to parse JSON data from an HTTPS protocol so I downloaded and integrated libcurl into my VS2010.
Everything works fine and sample codes work fine when I use "http" protocol.
However, a CURL error keeps coming out when I try to read from "https" protocol....
The error msg is "Error from cURL: Unsupported protocol"
My code is below. This code is from official web site (http://curl.haxx.se/libcurl/c/https.html) What am I missing?? Please help!
CURL *curl;
curl = curl_easy_init();
if(!curl)
{
cout << "Unable to initialize cURL interface" << std::endl;
return;
}
string curl_url = "https://www.cia.gov/";
curl_easy_setopt(curl, CURLOPT_URL, curl_url.c_str());
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
const CURLcode rc = curl_easy_perform(curl);
if( rc != CURLE_OK ) {
cout << "Error from cURL: " << curl_easy_strerror(rc) << std::endl;
return;
}
curl_easy_cleanup(curl);