PHP –  cURL - create a secure connection to APIs

I’ve been recently trying to use the Google+ and Google Drive APIs for a custom tool to manage your files inside a bigger CRM/ERP and storing them inside Google Drive. The web application is build in Laravel and I was using https://github.com/google/google-api-php-client

After setting up my app and getting the credentials inside inside the Google Console, when trying to hit the google’s endpoint for auth I got this nice error cURL error 60: SSL certificate problem: unable to get local issuer certificate

After spending a while looking for a solution on the web, found that saving the http://curl.haxx.se/ca/cacert.pem on your local machine and point your php.ini to it (lookup for curl.cainfo = “[enter path to the file here]\cacert.pem” — by default is commented out, add it if you really can not find it).

What’s very important is to save the files as it is, no alter of content, or copy/paste in a text editor and save it after — that won’t work.

As an alternative, if saving the file from its original location does not work, found the certificate saved in this gist https://gist.github.com/VersatilityWerks/5719158/download and it works like magic.

Hope this will save your time!

If you like this and find it useful please consider sharing it! Cheers!Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
 

C