Page 1 of 1

https with CURL problem.

PostPosted: 05. April 2016 06:23
by anishgiri
I am using xampp 1.7.1 on windows 7. My extension=php_openssl.dll is uncommented. I can't get to work my curl with a url that has https.

I tried these codes, but these does not work.
Code: Select all
$curl = curl_init('https://www.xxx.com/xxx/xxx/xxx');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
[b]curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,FALSE);[/b]
$page = curl_exec($curl);
curl_close($curl);
print_r($page);


Code: Select all
$curl = curl_init('https://www.xxx.com/xxx/xxx/xxx');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
[b]curl_setopt ($curl, CURLOPT_CAINFO, 'cacert.pem');[/b]
$page = curl_exec($curl);
curl_close($curl);
print_r($page);


From these link below, I tried saving a cert as .crt
https://curl.haxx.se/ca/cacert.pem

GlobalSign Root CA
==================
-----BEGIN CERTIFICATE-----
blah blah bla
-----END CERTIFICATE-----


and did this below, but it still does not work.

Code: Select all
curl_setopt($curl, CURLOPT_CAINFO, getcwd() . "GlobalSignRootCA.crt");