diff --git a/README.md b/README.md
index 4e5065e..855184b 100644
--- a/README.md
+++ b/README.md
@@ -146,3 +146,13 @@ You can clear the default headers anytime with:
```php
Unirest::clearDefaultHeaders();
```
+
+### SSL validation
+
+You can esplicitly enable or disable SSL certificate validation
+
+```php
+Unirest::verifiyPeer(false);
+```
+
+By default is `true`.
diff --git a/lib/Unirest/Unirest.php b/lib/Unirest/Unirest.php
index 38db49c..855aa5f 100644
--- a/lib/Unirest/Unirest.php
+++ b/lib/Unirest/Unirest.php
@@ -5,15 +5,20 @@
class Unirest
{
- /**
- * Verify SSL peer
- * @var bool
- */
- public static $verifyPeer = true;
+
+ private static $verifyPeer = true;
private static $socketTimeout = null;
private static $defaultHeaders = array();
+ /**
+ * Verify SSL peer
+ * @param bool $enabled enable SSL verification, by default is true
+ */
+ public static function verifyPeer($enabled) {
+ Unirest::$verifyPeer = $enabled;
+ }
+
/**
* Set a timeout
* @param integer $seconds timeout value in seconds
diff --git a/test/Unirest.php b/test/Unirest.php
index ec691b7..08b96e5 100644
--- a/test/Unirest.php
+++ b/test/Unirest.php
@@ -6,18 +6,18 @@ echo "Running the Unirest-PHP bindings test suite.\n".
$ok = @include_once(dirname(__FILE__).'/simpletest/autorun.php');
if (!$ok) {
- $ok = @include_once(dirname(__FILE__).'/../vendor/vierbergenlars/simpletest/autorun.php');
+ $ok = @include_once(dirname(__FILE__).'/../vendor/vierbergenlars/simpletest/autorun.php');
}
if (!$ok) {
- echo "MISSING DEPENDENCY: The Unirest-PHP test cases depend on SimpleTest. ".
- "Download it at , and either install it ".
- "in your PHP include_path or put it in the test/ directory.\n";
- exit(1);
+ echo "MISSING DEPENDENCY: The Unirest-PHP test cases depend on SimpleTest. ".
+ "Download it at , and either install it ".
+ "in your PHP include_path or put it in the test/ directory.\n";
+ exit(1);
}
// Throw an exception on any error
function exception_error_handler($errno, $errstr, $errfile, $errline) {
- throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
+ throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
}
set_error_handler('exception_error_handler');