So you can of course simply disable security by setting the options OptionSSLVerifyHost and OptionSSLVerifyPeer both to zero. This will accept any connection and transfer all data encrypted, but people could read it with a simple man in the middle attack.
For security, you can set OptionSSLVerifyHost to 2 to verify the server identity and set OptionSSLVerifyPeer to verify the certificate. Also you need a cacert.pem file with certificates. You can download it on the curl website. Than use OptionCAInfo with the path to let CURL load the certificates from this file.
If you have connection problems, please collect debug messages and check the text there for details on why your connection failed.