To debug/inspect cURL requests and responses in PHP, proxy the requests through an HTTP proxy like Charles:
curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1");
curl_setopt($ch, CURLOPT_PROXYPORT, 8888);
To avoid certificate trust errors, disable SSL certificate verification in your development environment (do not disable in production environments!):
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);