简体   繁体   English

curl错误:无法设置私钥文件

[英]curl error: unable to set private key file

Trying to implement Authipay payment gateway. 尝试实现Authipay付款网关。 Installed certificate successfully in the same directory. 在同一目录中成功安装了证书。

i am getting below error with use of realpath() :- 我使用realpath()遇到以下错误:-

unable to set private key file: 'D:\xampp\htdocs\authipay\WS13205400304._.1.key' type PEM

without realpath() :- 没有realpath() :-

unable to use client certificate (no key found or wrong pass phrase?)

i am trying below code:- 我正在尝试以下代码:-

$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);

googled and searching on stack a lot but still stuck with this problem. 谷歌搜索并在堆栈上搜索了很多,但仍然停留在这个问题上。 Any help would be appreciable 任何帮助都将是可观的

In line: 排队:

curl_setopt($ch, CURLOPT_SSLKEY, realpath"WS13205400304._.1.key"));
                                         ^
                                        HERE

you have got missing bracket ( after word realpath 您缺少括号(单词realpath

So your line must look like: 因此,您的行必须如下所示:

curl_setopt($ch, CURLOPT_SSLKEY, realpath("WS13205400304._.1.key"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM