我正在为网站进行支付系统集成。现在我正在使用xampp在本地计算机上进行测试。我已向银行服务器提交了.csr
文件,然后他们向我提供了.crt
文件。我也有一个.key
文件。
当我尝试将证书和某些值提交给包含证书文件路径(.crt
)和.key
文件的银行服务器时,它会抛出错误:
卷曲错误:错误:14094418:SSL例程:ssl3_read_bytes:tlsv1 alert unknown ca
我的代码是:
$twpg_gateway_url = '<bankurl>';
$twpg_cert_file = getcwd().'<.crtfile with path>';
$twpg_key_file = getcwd().'<.keyfile with path>';
$twpg_key_password = '';
$curl = curl_init();
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => true,
CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
//CURLOPT_VERBOSE => true,
CURLOPT_URL => $twpg_gateway_url . '/Exec',
CURLOPT_POSTFIELDS => $request,
CURLOPT_HTTPHEADER => array('Content-Type: text/xml'),
CURLOPT_TIMEOUT => 30
);
if ($twpg_cert_file != '') {
$options[CURLOPT_SSLCERT] = $twpg_cert_file;
$options[CURLOPT_SSLKEY] = $twpg_key_file;
$options[CURLOPT_SSLKEYPASSWD] = $twpg_key_password;
}
curl_setopt_array($curl, $options);
$response = curl_exec($curl);
if(!$response)
{
echo "Curl Error : " . curl_error($curl);
}
curl_close($curl);
return $response;