Roots Discourse

cURL - Self signed certificate issue

I’ve got a simple php script which is connecting to my wordpress to create a product. Using the woocommerce rest api library.

$woocommerce = new Client(
      'wp_api' => true,
      'version' => 'wc/v3',
      'sslverify' => false,

// foreach item

$woocommerce->post( 'products', $data );

Fatal error: Uncaught Automattic\WooCommerce\HttpClient\HttpClientException: cURL Error: SSL certificate problem: self signed certificate in /srv/www/ on line 417

I’ve attempted the following:
Get the certificate from the dev site:

openssl s_client -connect | tee logfile

Copied the certificate and made a file from it called certificate.crt


Uploaded to:


And now trying to use it to prevent this error.

add_action( 'http_api_curl', function( $handle ) {
	curl_setopt($handle, CURLOPT_CAINFO, ABSPATH . 'certificate.crt');

// the value of ABSPATH is: /srv/www/

Same error remains. Can’t tell if the custom cert is being used or not too. If it is then something else must be wrong maybe.

This topic was automatically closed after 42 days. New replies are no longer allowed.