cURL / Mailing Lists / curl-users / Single Mail


Re: CURL return Values

From: John Vorwald <>
Date: Mon, 11 Dec 2006 05:02:40 -0500

I have gotten a curl command line statement to work, but am unable to convert the command to libcurl to work in a C++ code.

Here's the command line statement that works.

curl --data-binary "VTI-GROUP=0&partId=_userid_&password=_passid_&acrover=7&fileDigit=A&Enter=Login" \
     --user-agent "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" \
     --referer<> \
     --output step4b.out \
     --trace-ascii step4b.trace \
     --dump-header step4b.hdr \

Here's my C++ code to implement the command line options

  CURL *curl;
  char *url("$=3ABC123<$=3ABC123>");
  char *body_file_name("tsp_login.txt");

  curl = curl_easy_init();
  if (curl) {

    curl_easy_setopt(curl, CURLOPT_USERAGENT,
                   "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0");
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
    curl_easy_setopt(curl, CURLOPT_POST, 1);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS,
    curl_easy_setopt(curl, CURLOPT_REFERER, "<>");

    FILE *outfile = fopen(body_file_name, "wb");
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);

    curl_easy_setopt(curl, CURLOPT_URL, url);
    res = curl_easy_perform(curl);

    /* Cleanup before exit */

Here's the output when running the C++ code

* About to connect() to port 443
* Trying * connected
* Connected to ( port 443
* SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Suggestions on how to correct the C++ code. Seems to be a problem with the SSL certificate. Can I display the certificate file being used by libcurl. I used the default in the command line entry.

Received on 2006-12-11