Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ protected static function cUrl($url, $data = array(), DateTime $modifiedSince =
$headers[] = 'IF-MODIFIED-SINCE: ' . $modifiedSince->format(DateTime::RFC1123);
}
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

$pathToCert = Config::getPathToPeerVerificationCert();

if(!empty($pathToCert)) {
curl_setopt($curl, CURLOPT_CAINFO, $pathToCert);
}

$json = curl_exec($curl);
curl_close($curl);

Expand Down
33 changes: 32 additions & 1 deletion src/Helpers/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,35 @@ abstract class Config
'url' => 'notes',
'delete' => 'notes',
);
}

/**
* @var string
*/
private static $pathToPemFile = '';

/**
* @see https://curl.haxx.se/libcurl/c/CURLOPT_CAINFO.html
* @see \DrillCoder\AmoCRM_Wrap\Base::cUrl()
*
* @return string
*/
public static function getPathToPeerVerificationCert()
{
return self::$pathToPemFile;
}

/**
* @see https://curl.haxx.se/libcurl/c/CURLOPT_CAINFO.html
* @see \DrillCoder\AmoCRM_Wrap\Base::cUrl()
*
* @param string $pathToPemFile
*
* @return void
*/
public static function setPathToPeerVerificationCert($pathToPemFile)
{
if (file_exists($pathToPemFile)) {
self::$pathToPemFile = $pathToPemFile;
}
}
}