Goutte icon indicating copy to clipboard operation
Goutte copied to clipboard

cURL error 60: SSL certificate problem: unable to get local issuer certificate

Open rashedshaon opened this issue 10 years ago • 7 comments
trafficstars

I want crawl a site which is HTTPS: The following error occurred when I start crawling. RequestException in RequestException.php line 51: cURL error 60: SSL certificate problem: unable to get local issuer certificate

rashedshaon avatar May 22 '15 14:05 rashedshaon

From your machine can you test if you can fetch it via curl on the cli? Suspect its your SSL configuration.

larowlan avatar May 22 '15 21:05 larowlan

after that updates the library @stable with composer I have the same problem

curl https://www.xxxxx.com/category/market/ curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). If the default bundle file isn't adequate, you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option.

gnovaro avatar Oct 26 '15 15:10 gnovaro

Set Goutte 2’s CURLOPT_SSL_VERIFYPEER to false, or search issues for other Goutte versions.

$client->getClient()->setDefaultOption('config/curl/' . CURLOPT_SSL_VERIFYPEER, false);

ssanders avatar Oct 26 '15 15:10 ssanders

Thanks for your answer, now works but I use this format //Scrapper use Goutte\Client;

$client = new \Goutte\Client();

// Create and use a guzzle client instance that will time out after 90 seconds $guzzleClient = new \GuzzleHttp\Client(array( 'timeout' => 90, 'verify' => false, ));

$client->setClient($guzzleClient);

gnovaro avatar Oct 26 '15 19:10 gnovaro

Thank you so much @gnovaro :D Your solution works well here!

TSerra-PT avatar Nov 22 '16 12:11 TSerra-PT

Note that disabling the peer verification is not a solution. It is a security issue as it means you are not checking the SSL certificate anymore, defeating the purpose of HTTPS. Instead, you should fix your system so that it has the proper CA file to be able to validate certificates.

stof avatar Nov 22 '16 12:11 stof

so what is the best solution? @stof

TSerra-PT avatar Nov 22 '16 16:11 TSerra-PT