dox19458 2014-07-04 02:16
浏览 138
已采纳

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

Trying to implement Authipay payment gateway. Installed certificate successfully in the same directory.

i am getting below error with use of realpath():-

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

without 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

  • 写回答

1条回答 默认 最新

  • duan032225 2014-07-04 02:21
    关注

    In line:

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

    you have got missing bracket ( after word realpath

    So your line must look like:

    curl_setopt($ch, CURLOPT_SSLKEY, realpath("WS13205400304._.1.key"));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 WSL上下载的joern在windows怎么用?
  • ¥17 MC9S12XS128单片机开发板实验
  • ¥15 jetson nano4GB
  • ¥15 电脑回复出厂设置,重装过程报错提示,求解决方案Windows 无法分析或处理无人参与应答文件 [C:\WINDOWS\Panther\unattend.xml,如何解决?
  • ¥15 进入lighttools中的UDOP编辑器的方法
  • ¥15 求Gen6d训练数据集
  • ¥20 liunx中winscp中可以登入ftp,但是不能登入sftp,如何解决
  • ¥15 lighttools的光学属性自定义的用法流程
  • ¥15 uni-app动态修改推荐页标题时报错
  • ¥15 图片是GET请求,后面是图片的id,Glide如何缓存?
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部