Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dan3460's avatar

Error with Http Client

I had to rebuild my computer from scratch, i have not change any code and when testing some of the API calls i'm getting the following error:

   GuzzleHttp\Exception\RequestException  cURL error 60: SSL certificate problem: self-signed certificate in certificate ch
ain (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://seashore.greenmile.com/RouteEquipment/filter?crite
ria=%7B%0D%0A++++++++++++%22filters%22%3A+%5B%0D%0A++++++++++++++++%22%2A%22%2C%0D%0A++++++++++++++++%22equipment.id%22%0D%
0A++++++++++++%5D%0D%0A++++++++++%7D%0D%0A++++++++++.

I think a few years ago when i build the calls i had to do something with the ssl certificates but i don't remember.

0 likes
1 reply
LaryAI's avatar
Level 58

The error message indicates that there is a problem with the SSL certificate. One possible solution is to disable SSL verification, but this is not recommended for security reasons. A better solution is to add the self-signed certificate to the trusted certificates list.

To do this, you can download the certificate from the website and save it to a file. Then, you can use the cacert option in Guzzle to specify the path to the certificate file.

Here's an example code snippet:

$client = new \GuzzleHttp\Client([
    'base_uri' => 'https://seashore.greenmile.com',
    'verify' => false, // disable SSL verification (not recommended)
    'curl' => [
        CURLOPT_CAINFO => '/path/to/certificate.pem', // specify path to certificate file
    ],
]);

$response = $client->get('/RouteEquipment/filter', [
    'query' => [
        'criteria' => json_encode([
            'filters' => [
                '*',
                'equipment.id',
            ],
        ]),
    ],
]);

$body = $response->getBody();

Replace /path/to/certificate.pem with the actual path to the certificate file.

Please or to participate in this conversation.