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!
Advertisement
Answer
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