J7mbo / twitter-api-php

The simplest PHP Wrapper for Twitter API v1.1 calls
MIT License
1.82k stars 802 forks source link

Fatal error: Uncaught Exception: SSL certificate problem: #264

Closed MrShabir closed 5 years ago

MrShabir commented 6 years ago

Hello I have problem with this API file. Fatal error: Uncaught Exception: SSL certificate problem: unable to get local issuer certificate in TwitterAPIExchange.php on line 321 I am working on localhost. I am using this method. https://code.tutsplus.com/tutorials/create-a-twitter-widget-with-the-latest-twitter-api--cms-21535

paul1278 commented 6 years ago

It's an error thrown by cURL, to solve it follow these steps: 1) Download the latest cacert.pem from https://curl.haxx.se/ca/cacert.pem 2) Add the line curl.cainfo="/path/to/downloaded/cacert.pem" to your php.ini-file

MrShabir commented 6 years ago

Thanks for your reply. I was already download this file and was include in my plugin directory. So if i will add this file in php.ini file then no need to include in plugin file?? Also on live server it will work fine??

paul1278 commented 6 years ago

The error happens when cURL is trying to download content from a SSL-enabled site without a local issuer certificate, so you must give this certificate to cURL. You can put the file wherever you want if your webserver can access it and the path in your php.ini-file points to this file so that cURL can use it. If it will work on a live server depends on it's configuration.

J7mbo commented 5 years ago

Hopefully this is solved now. It's a cURL issue.

As this is an old issue, I'm closing it, but if you still feel that something needs to be addressed, please feel free to reopen or open a new issue and we'll solve it together! :)