Remove SSL Verify on Windows #12

Open
WengerK wants to merge 2 commits from WengerK/master into master
Showing only changes of commit 1eab9c4f5c - Show all commits

View file

@ -8,20 +8,22 @@ class GooglePlacesClient
{ {
$curl = curl_init(); $curl = curl_init();
$ssl_verifypeer = true;
// Remove ssl certificate verification for Windows
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
{
$ssl_verifypeer = false;
}
$options = array( $options = array(
CURLOPT_URL => $url, CURLOPT_URL => $url,
CURLOPT_HEADER => false, CURLOPT_HEADER => false,
CURLOPT_SSL_VERIFYPEER => true, CURLOPT_SSL_VERIFYPEER => $ssl_verifypeer,
CURLOPT_RETURNTRANSFER => true, CURLOPT_RETURNTRANSFER => true,
); );
curl_setopt_array($curl, $options); curl_setopt_array($curl, $options);
// Add certificate for Windows
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
}
$response = curl_exec($curl); $response = curl_exec($curl);
if ($error = curl_error($curl)) if ($error = curl_error($curl))