x-fran / g-trends

Google Trends API for PHP
https://tarlabs.es
MIT License
112 stars 47 forks source link

Error in cURL request: SSL certificate problem: unable to get local issuer certificate #29

Closed declankay closed 4 years ago

declankay commented 4 years ago

Hello,

When using the default index.php file provided by g-trends, the following error message appears,on WAMP localhost:

"Error in cURL request: SSL certificate problem: unable to get local issuer certificate"

Does this issue mean that we should not test this tool on a localhost machine or is there a step we can do to allow this error to get corrected?

x-fran commented 4 years ago

Hello,

 $client->setOptions([
            'curloptions' => [
                CURLOPT_COOKIEFILE => $cookieJar,
                CURLOPT_CERTINFO => false, <= try by adding this line
            ]]);
declankay commented 4 years ago

Hello, the above solution did not fix the issue.

However, i managed to overcome the issue by amending one of the following file: vendor/laminas/laminas-http/src/client/adapter/curl.php

Line 202: $this->curl = curl_init();

Below this, add two lines:

curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, 0);

Please note, this should only be done on a local machine and not for live websites.

I would also recommend to users who have a similar issue should follow this tutorial: https://zuziko.com/tutorials/how-to-enable-https-ssl-on-wamp-server/