Our existing system (ubuntu server) uses curl to connect to another remote server over https. From any browser connection works and we get a response. I opened the port 443 to make sure that it is not being blocked by the firewall.
For testing, I used the curl command via the terminal and received the error:
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines: SSL3_GET_SERVER_CERTIFICATE:certificate verify failed.
Then after I specified the pem file using --cacert
when running the curl command.
Now it shows that "https not supported or disabled in libcurl"
However, when I view the curl information it lists the following: libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15 which makes it seem that it includes SSL support.
Additionally, when I view the phpinfo it shows curl is enabled with OpenSSL which seems that the support is built-in. I've attempted setting the curl_setopt
within the script but still no success.
Any suggestions?
Here is a snippet of the code from the script:
$url = 'https://ourserver.com/user/';
$fields = array(
'user' => urlencode($user),
'password' => urlencode($pass),
);
foreach ($fields as $key => $value) {
$fields_string .= $key . '=' . $value . '&';
}
rtrim($fields_string, '&');
curl_setopt($ch, CURLOPT_CAINFO, '/home/test/key.pem');
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url . '?' . $fields_string,
CURLOPT_USERAGENT => 'Sample cURL Request'
));
$resp = curl_exec($curl);
curl_close($curl);