Hello,
Ref to https://woocommerce.github.io/woocommerce-rest-api-docs/#rest-api-keys you create a URL that should return you to your site/application when you create a Rest API key.
But I got the next 2 messages when wish to connect my PHP app to Woocommerce in a local development environment and using a self-signed certificate.
Error: A valid URL was not provided..
and
Error: cURL error 60: SSL certificate problem: self signed certificate.
both come from different places. I resolved my problem with the first message by adding this code in functions.php in theme:
function turn_off_reject_unsafe_urls($args) {
$args['reject_unsafe_urls'] = false;
return $args;
}
add_filter( 'http_request_args', 'turn_off_reject_unsafe_urls');
and second by adding:
add_action('http_api_curl', function( $handle ){
//Don't verify SSL certs
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false);
// //Use Charles HTTP Proxy
// curl_setopt($handle, CURLOPT_PROXY, "127.0.0.1");
// curl_setopt($handle, CURLOPT_PROXYPORT, 8888);
}, 10);
I hope this will help you.
!! Don’t use this code on a live server. This Code is only for local/localhost development and you have a problem with Self signed certificate !!!
Views: 103
