2

I'm trying to test the DeepL API on my local machine but I'm getting this error in PHP :

DeepL\ConnectionException: SSL certificate problem: self signed certificate in certificate chain.

My code is simple :

<?php
require __DIR__ . '/vendor/autoload.php';
use DeepL\DeepLException;
use DeepL\Translator;

try
{
    $authKey = "HIDDEN_KEY";
    $translator = new Translator($authKey);
    $result = $translator->translateText('Hello, world!', null, 'fr');
    echo $result->text; // Should print "Bonjour, le monde!"
} catch (DeepLException $e)
{
    echo "KO";
    error_log($e);
}

I realize this probably won't happen on the actual server but isn't there any way to test the API locally first ?

1 Answers1

0

As the DeepL PHP library uses cURL to make HTTP-requests, this could be the same problem as answered here: Curl error 60, SSL certificate issue: self signed certificate in certificate chain.

Try making sure that your installation of PHP has a CA root certificate, and that it’s up to date.

Daniel Jones
  • 116
  • 1
  • 4