doraemon0769 2012-05-01 14:33
浏览 54
已采纳

cURL SSL请求失败

I'm trying to work with Liveperson REST API, I use the following php code:

$authorization = "LivePerson appKey=MY_APP_KEY";
$accept = "application/xml";
$contentType = "application/xml";


$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "C:/dev/wamp/exported.crt");

curl_setopt($ch, CURLOPT_URL, "https://dev.liveperson.net/api/account/1234?v=1");
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Authorization: '.$authorization,'Accept: '.$accept,'Content-Type: '.$contentType));
curl_exec($ch);
$response = curl_getinfo( $ch );
var_export($response);
curl_close($ch);

The request fails, I already tried the following

  • enabeling openssl on php.ini
  • exporting the certificate from liveperson server and using it in my code
  • followed the instruction here

any help will be appreciated!

  • 写回答

2条回答 默认 最新

  • dsmupo6631 2012-05-01 14:45
    关注

    Try removing getcwd() from line 9 in your code. You are using fullpath "C:/dev/wamp/exported.crt", that is relative to your current working directory, this is wrong. :)

    Hope this solves it

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置