我试图在本地机器上测试PHP,但是我在DeepL中得到了这个错误:
DeepL\ConnectionException: SSL certificate problem: self signed certificate in certificate chain.我的代码很简单:
<?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);
}我意识到这可能不会发生在实际的服务器上,但是没有任何方法可以先在本地测试API吗?
发布于 2022-09-01 14:52:06
由于DeepL PHP库使用cURL发出HTTP,这可能是与这里回答的问题相同的问题:Curl error 60, SSL certificate issue: self signed certificate in certificate chain。
尝试确保PHP的安装具有CA根证书,并且它是最新的。
https://stackoverflow.com/questions/72951701
复制相似问题