logger->notice('Соединение не защищено. Необходимо включить SSL шифрование'); } if ($curl = curl_init()) { curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_USERAGENT, $_ENV['USERAGENT']); if (isset($post_values)) { curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $post_values); } if ($cookie and isset(self::$cookie)) { $send_cookie = []; foreach (self::$cookie as $cookie_name => $cookie_val) { $send_cookie[] = "$cookie_name=$cookie_val"; } curl_setopt($curl, CURLOPT_COOKIE, join('; ', $send_cookie)); } curl_setopt( $curl, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$headers) { $len = strlen($header); $header = explode(':', $header, 2); if (count($header) < 2) // ignore invalid headers return $len; $name = strtolower(trim($header[0])); if (isset($headers) and !array_key_exists($name, $headers)) $headers[$name] = [trim($header[1])]; else $headers[$name][] = trim($header[1]); return $len; } ); $out = curl_exec($curl); curl_close($curl); //if (isset($headers['set-cookie'])) // $this->parseCookie($headers['set-cookie']); return ['header' => $headers, 'body' => $out]; } } protected static function checkSSL($domain) { $ssl_check = @fsockopen('ssl://' . $domain, 443, $errno, $errstr, 30); $res = !!$ssl_check; if ($ssl_check) { fclose($ssl_check); } return $res; } }