cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: how do i post json to a https ?

From: Ray Satiro <raysatiro_at_yahoo.com>
Date: Fri, 09 Jan 2015 20:44:08 -0500

On 1/9/2015 11:03 AM, redmond wrote:
> though im unfamilar with C/C++,i have wrote the following code with
> libcurl docs,how do i post the json on https(the ssl website has no
> cert,just like https://www.google.com,it don't need the cert)?i search
> google for this,however there is no answer.i tried to write the
> following code,are these correct?how do i determine the http server
> respond ok ?in addition,static method is not allow use in dll

Typically the SSL backend used by libcurl will have a database of
certificates and/or you'll have to load your own to verify your website.

In your code the read function really isn't necessary for what you are
doing. As documented in CURLOPT_POST [1] you'll need chunked transfer
encoding if you are going to use a read function. I made an example for
you without a read function at
https://gist.github.com/jay/2a6c54cc6da442489561

[1]: http://curl.haxx.se/libcurl/c/CURLOPT_POST.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-01-10