Php 卷曲错误:无法设置私钥文件
正在尝试实现Php 卷曲错误:无法设置私钥文件,php,curl,Php,Curl,正在尝试实现Authipay支付网关。已在同一目录中成功安装证书 使用realpath(),我发现以下错误:- 没有realpath():- unable to use client certificate (no key found or wrong pass phrase?) 我正在尝试以下代码:- $ch = curl_init("https://test.ipg-online.com/ipgapi/services"); curl_setopt($ch, CURLOPT_POST, 1
Authipay
支付网关。已在同一目录中成功安装证书
使用realpath()
,我发现以下错误:-
没有realpath()
:-
unable to use client certificate (no key found or wrong pass phrase?)
我正在尝试以下代码:-
$ch = curl_init("https://test.ipg-online.com/ipgapi/services");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "user:pass");
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CAINFO, realpath("geotrust.pem"));
curl_setopt($ch, CURLOPT_SSLCERT, realpath("WS13205400304._.1.pem"));
curl_setopt($ch, CURLOPT_SSLKEY, realpath("WS13205400304._.1.key"));
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, "ckp_".time());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
print_r(curl_getinfo($ch));
echo curl_error($ch);
curl_close($ch);
谷歌搜索了很多堆栈,但仍然存在这个问题。任何帮助都将是可观的在以下方面:
curl_setopt($ch, CURLOPT_SSLKEY, realpath"WS13205400304._.1.key"));
^
HERE
您在wordrealpath
因此,您的线路必须如下所示:
curl_setopt($ch, CURLOPT_SSLKEY, realpath("WS13205400304._.1.key"));
这不是问题,这是一些粘贴未更新,否则您将看到syntex错误
curl_setopt($ch, CURLOPT_SSLKEY, realpath("WS13205400304._.1.key"));