title: curl Programming to access https site
body: <p>I downloaded the source code of Curl and built the library (libcurl.lib). Following is the code to read from the site and dump the contents. 
  The code works well for http sites and fails for https. I tried downloading openssl libraries but unable to link them as more linker errors are thrown.</p>
  
  <p>What is the best solution to handle this?</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;curl/curl.h&gt;
  
  
  static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
  {
      ((std::string*)userp)-&gt;append((char*)contents, size * nmemb);
      return size * nmemb;
  }
  
  int main(void)
  {
      CURL *curl;
      CURLcode res;
      std::string readBuffer;
      std::string curl_url = "https://www.example.com/";
      curl = curl_easy_init();
      if(curl) {
          curl_easy_setopt(curl, CURLOPT_URL, curl_url.c_str());
          curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
          curl_easy_setopt(curl, CURLOPT_WRITEDATA, &amp;readBuffer);
          res = curl_easy_perform(curl);
          if (res != CURLE_OK) {
              std::cout &lt;&lt; "Error from cURL: " &lt;&lt; curl_easy_strerror(res) &lt;&lt; std::endl;
          }
          curl_easy_cleanup(curl);
          std::cout &lt;&lt; "Finished reading from the website" &lt;&lt; std::endl;
          std::cout &lt;&lt; readBuffer &lt;&lt; std::endl;
      }
      return 0;
  }
  </code></pre>