Remove SSL Verify on Windows #12
1 changed files with 8 additions and 6 deletions
|
@ -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))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue