The best solution would be to update the SSL certificate on the server. However, if that is not possible, you can add the SSL certificate to your local certificate store and tell cURL to use it. Here's how:
-
Download the SSL certificate from Slack's website. You can find it by going to https://slack.com/help/articles/115002422943 and clicking on "Download the CA certificate".
-
Save the certificate to a file on your server. For example, you could save it to /etc/ssl/certs/slack.crt.
-
Tell cURL to use the certificate by adding the following line of code before the cURL request:
curl_setopt($ch, CURLOPT_CAINFO, '/etc/ssl/certs/slack.crt');
This tells cURL to use the certificate at /etc/ssl/certs/slack.crt for SSL verification.
- Remove the line of code that disables SSL verification:
CURLOPT_SSL_VERIFYPEER => false,
- Test your code to make sure it works.
By adding the SSL certificate to your local certificate store, you are telling cURL to trust the certificate and use it for SSL verification. This is a more secure solution than disabling SSL verification altogether.