我試圖與Liveperson REST API的工作,我用下面的PHP代碼:捲曲SSL請求失敗
$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);
請求失敗,我已經試過以下
- enabeling上的OpenSSL php.ini
- 從liveperson服務器導出證書並在我的代碼中使用它
- 跟隨指令here
任何幫助將不勝感激!
什麼部分請求的失敗?你會得到什麼錯誤? – Sietse
這行「curl_setopt($ ch,CURLOPT_CAINFO,getcwd()。」C:/dev/wamp/exported.crt「);」似乎有點粗略。 – ethrbunny