From 643fc7ba6b005f1e3e36ab2524a7716807414fc1 Mon Sep 17 00:00:00 2001 From: jasir Date: Wed, 18 Dec 2013 14:36:26 +0100 Subject: [PATCH] Added possibility to switch off/on SSL verify peer option using Unirest::$verifyPeer #27 --- lib/Unirest/Unirest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Unirest/Unirest.php b/lib/Unirest/Unirest.php index 70197be..38db49c 100644 --- a/lib/Unirest/Unirest.php +++ b/lib/Unirest/Unirest.php @@ -5,6 +5,11 @@ class Unirest { + /** + * Verify SSL peer + * @var bool + */ + public static $verifyPeer = true; private static $socketTimeout = null; private static $defaultHeaders = array(); @@ -151,7 +156,7 @@ curl_setopt ($ch, CURLOPT_MAXREDIRS, 10); curl_setopt ($ch, CURLOPT_HTTPHEADER, $lowercaseHeaders); curl_setopt ($ch, CURLOPT_HEADER, true); - curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, true); + curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, Unirest::$verifyPeer); curl_setopt ($ch, CURLOPT_ENCODING, ""); // If an empty string, "", is set, a header containing all supported encoding types is sent. if (Unirest::$socketTimeout != null) { curl_setopt ($ch, CURLOPT_TIMEOUT, Unirest::$socketTimeout);