private function get_headers($httpType, $cookies)
    {
        // Common header flags.
        $headers = [];
        $headers[] = 'Dnt: 1';
        $headers[] = 'Connection: keep-alive';
        $headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4';
        $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36';

        // Add additional headers based on the type of request.
        switch ($httpType) {
        case 'origin':
          $headers[] = 'Origin: '.self::MY_TELEGRAM_URL;
          $headers[] = 'Accept-Encoding: gzip, deflate, br';
          $headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8';
          $headers[] = 'Accept: application/json, text/javascript, */*; q=0.01';
          $headers[] = 'Referer: '.self::MY_TELEGRAM_URL.'/auth';
          $headers[] = 'X-Requested-With: XMLHttpRequest';
        break;
        case 'refer':
          $headers[] = 'Accept-Encoding: gzip, deflate, sdch, br';
          $headers[] = 'Upgrade-Insecure-Requests: 1';
          $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
          $headers[] = 'Referer: '.self::MY_TELEGRAM_URL;
          $headers[] = 'Cache-Control: max-age=0';
        break;
        case 'app':
          $headers[] = 'Origin: '.self::MY_TELEGRAM_URL;
          $headers[] = 'Accept-Encoding: gzip, deflate, br';
          $headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8';
          $headers[] = 'Accept: */*';
          $headers[] = 'Referer: '.self::MY_TELEGRAM_URL.'/apps';
          $headers[] = 'X-Requested-With: XMLHttpRequest';
        break;
        }

        // Add every cookie to the header.
        foreach ($cookies as $cookie) {
            $headers[] = 'Cookie: '.$cookie;
        }

        return $headers;
    }