Skip to content

Commit

Permalink
Merge pull request #29 from jasir/fix-27
Browse files Browse the repository at this point in the history
Added possibility to switch off SSL verify peer option using Unirest::verifyPeer #27
  • Loading branch information
subnetmarco committed Jan 6, 2014
2 parents 45cb590 + 643fc7b commit 389b90a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Unirest/Unirest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

class Unirest
{
/**
* Verify SSL peer
* @var bool
*/
public static $verifyPeer = true;

private static $socketTimeout = null;
private static $defaultHeaders = array();
Expand Down Expand Up @@ -151,7 +156,7 @@ private static function request($httpMethod, $url, $body = NULL, $headers = arra
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);
Expand Down

0 comments on commit 389b90a

Please sign in to comment.