I am trying to connect to an API using cURL
and https
and I don't get it work.
It work perfectly with http
but when i change it to https
in the $url
variable, it takes more than 30 seconds to execute and finally it shows false
as a result.
This is the function:
$url = 'https://api.xxxxxxx.com/api.php?user=xxxx&pass=xxxx';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
If I debug with this:
debug(curl_init($url));
I get:
resource
Any idea which could be the cause?