5 && stripos($url, 'https') === 0) { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); } if (is_array($headers) && 0 < count($headers)) { $httpHeaders = self::getHttpHearders($headers); curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeaders); } $httpResponse = new HttpResponse(); $httpResponse->setBody(curl_exec($ch)); $httpResponse->setStatus(curl_getinfo($ch, CURLINFO_HTTP_CODE)); if (curl_errno($ch)) { throw new ClientException('Server unreachable: Errno: ' . curl_errno($ch) . ' ' . curl_error($ch), 'SDK.ServerUnreachable'); } curl_close($ch); return $httpResponse; } /** * @param $postFildes * * @return bool|string */ public static function getPostHttpBody($postFildes) { $content = ''; foreach ($postFildes as $apiParamKey => $apiParamValue) { $content .= "$apiParamKey=" . urlencode($apiParamValue) . '&'; } return substr($content, 0, -1); } /** * @param $headers * * @return array */ public static function getHttpHearders($headers) { $httpHeader = array(); foreach ($headers as $key => $value) { $httpHeader[] = $key . ':' . $value; } return $httpHeader; } }