Skip to content
This repository was archived by the owner on Oct 13, 2022. It is now read-only.

Commit 7ae6cf2

Browse files
committed
Force SSL checking
TIme to practice what I preach.
1 parent 75f3d2e commit 7ae6cf2

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/UnionCloud/Api.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public function setAuthToken($token, $token_expires) {
3232
private function _curl($endpoint, $verb) {
3333
$curl = new Curl();
3434
$curl->setUserAgent('UnionCloud API PHP Wrapper v' . $this->VERSION);
35-
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
35+
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, true);
36+
$curl->setOpt(CURLOPT_SSL_VERIFYHOST, 2);
3637

3738
$curl->setHeader("Content-Type", "application/json");
3839
if ($this->auth_token != null) {
@@ -95,6 +96,10 @@ private function _post($endpoint, $post_data, $get_fields = null) {
9596
$curl->setOpt(CURLOPT_POSTFIELDS, json_encode($post_data, JSON_UNESCAPED_SLASHES));
9697
$curl->exec();
9798

99+
//if (array_key_exists("error", $curl->response)) {
100+
// throw new Exception($curl->response["error"]["error_message"], $curl->response["error"]["error_code"]);
101+
//}
102+
98103
return $curl;
99104
}
100105

0 commit comments

Comments
 (0)