Sends HTTP headers.

@return $this
559613
public function sendHeaders(): self
    {
        // headers have already been sent by the developer
        if (\headers_sent()) {
            return $this;
        }

        /* RFC2616 - 14.18 says all Responses need to have a Date */
        if (!$this->header->has('Date')) {
            $this->setDate(\DateTime::createFromFormat('U', (string) \time()));
        }

        // status
        \header('HTTP/' . $this->version . ' ' . $this->status . ' ' . $this->reason, true, $this->status);

        // headers
        $headers = $this->header->all();
        $this->cookie->inject($headers);

        foreach ($this->header->all() as $name => $values) {
            $first = true;
            foreach ($values as $value) {
                \header($name . ': ' . $value, $first, $this->status);
                $first = false;
            }
        }

        return $this;
    }
929450
public function sendHeaders()
    {
        // first build headers -> only if they haven't already been sent
        if (!headers_sent()) {
            // status code header
            header(self::PROTOCOL . ' ' . $this->getStatusCode() . ' ' . $this->statusMessage
            );

            // other headers
            foreach ($this->headers as $k => $v) {
                header($k . ': ' . $v);
            }

            // cache control headers
            $cacheControlHeaders = $this->cacheControl->getCacheControl();
            foreach ($cacheControlHeaders as $k => $v) {
                header($k . ': ' . $v);
            }
        }

        return $this;
    }
1216520
protected function _sendRequest()
    {
        $this->_response = $this->_factory
            ->getNewCancelSendRequest($this->_api, $this->_request)
            ->send();
        return $this;
    }
265413
protected function sendWebServiceRequest()
    {
        $this->response = $this->http->post(WebService::SIGEP, [
            'http_errors' => false,
            'body' => $this->body,
            'headers' => [
                'Content-Type' => 'application/xml; charset=utf-8',
                'cache-control' => 'no-cache',
            ],
        ]);

        return $this;
    }
493429
public function sendHeaders()
    {
        //iteracja po nagłówkach
        foreach ($this->_headers as $key => $header) {
            //usuwanie nagłówka z rejestru
            unset($this->_headers[$key]);
            //wysłanie nagłówka
            $header->send();
        }
        return $this;
    }
728074
public function sendHeaders()
    {
        /* Отправляем основной заголовок */
        $statusText = $this->statusText ?: self::getStatusText($this->getStatusCode());
        $header = 'HTTP/'
            . $this->getProtocolVersion() . ' '
            . $this->getStatusCode() . ' '
            . $statusText;
        header($header, true, $this->getStatusCode());

        /* Отправляем дополнительные заголовки */
        foreach ($this->headers as $header)
        {
            header($header);
        }
        return $this;
    }
674172
public function sendHeaders()
    {
        foreach ($this->_headers as $key => $value) {
            if (is_array($value)) {
                foreach ($value as $v) {
                    header($key.': '.$v, false);
                }
            } else {
                header($key.': '.$value);
            }
        }

        return $this;
    }
1262042
public function sendHeaders()
    {
        deprecationWarning(
            'Will be removed in 4.0.0'
        );

        $file = $line = null;
        if (headers_sent($file, $line)) {
            Log::warning("Headers already sent in {$file}:{$line}");

            return;
        }

        $codeMessage = $this->_statusCodes[$this->_status];
        $this->_setCookies();
        $this->_sendHeader("{$this->_protocol} {$this->_status} {$codeMessage}");
        $this->_setContentType();

        foreach ($this->headers as $header => $values) {
            foreach ((array)$values as $value) {
                $this->_sendHeader($header, $value);
            }
        }
    }
881325
public function setHeader()
    {
        $args = func_get_args();

        if (is_array($args[0])) {
            foreach ($args[0] as $key => $value)
                $this->headers['headers'][$key] = $value;
        } else {
            $this->headers['headers'][$args[0]] = $args[1];
        }

        return $this;
    }
129796
public function sendHeaders()
    {
        if (!$this->headersAreSent()) {
            header(
                sprintf(
                    'HTTP/%s %s %s',
                    $this->httpVersion,
                    $this->statusCode,
                    $this->statusText
                ),
                true,
                $this->statusCode
            );

            // Send the headers
            foreach ($this->headers->getAll() as $name => $values) {
                // Headers are allowed to have multiple values
                foreach ($values as $value) {
                    header("$name:$value", false, $this->statusCode);
                }
            }

            // Send the cookies
            /** @var Cookie $cookie */
            foreach ($this->headers->getCookies(true) as $cookie) {
                setcookie(
                    $cookie->getName(),
                    $cookie->getValue(),
                    $cookie->getExpiration(),
                    $cookie->getPath(),
                    $cookie->getDomain(),
                    $cookie->isSecure(),
                    $cookie->isHttpOnly()
                );
            }
        }
    }
983061
public function send_http_headers() {
        $this->writer = \Box\Spout\Writer\WriterFactory::create($this->spouttype);
        if (method_exists($this->writer, 'setTempFolder')) {
            $this->writer->setTempFolder(make_request_directory());
        }
        $filename = $this->filename . $this->get_extension();
        $this->writer->openToBrowser($filename);

        // By default one sheet is always created, but we want to rename it when we call start_sheet().
        $this->renamecurrentsheet = true;
    }
1335263
private function sendHead(): Response
    {
        $this->header($this->status->line($this->version, $this->sapi));
        foreach ($this->headers as $name => $value) {
            $this->header($name . ': ' . $value);
        }

        foreach ($this->cookies as $cookie) {
            $cookie->send();
        }

        $this->header('Content-type: ' . $this->mimeType);
        if (!$this->headers->contain('X-Request-ID')) {
            $this->header('X-Request-ID: ' . $this->request->id());
        }

        return $this;
    }
1241922
public static function sendHeaders()
    {
        if (! headers_sent()) {
            foreach (self::$headers as $header) {
                header($header, true);
            }

            return true;
        }

        return false;
    }
241210
public function sendHeaders()
    {
        // Throw exception if header already sent
        if ($this->headersSent()) {
            throw new ResponseException('Cannot send headers, headers already sent.');
        }

        /*
         | If headers not set already we will set header here
         */
        if (!$this->headers->has('Content-Type')) {
            $this->setHeader('Content-Type', $this->getContentType().'; charset='.$this->getCharset());
        }

        // Check if script is running in FCGI server
        if ($this->server('FCGI_SERVER_VERSION')) {
            //We will set Header for Fast-CGI server
            $this->setFastCgiHeader();
        } else {
            $this->setHeaderForServer();
        }

        foreach ($this->headers->all() as $name => $values) {
            foreach ($values as $value) {
                // Create the header and send it
                is_string($name) && $value = "{$name}: {$value}";
                header($value, true);
            }
        }

        return $this;
    }
1219796
public static function setHttpHeaders(){
		if(!is_array(self::$httpHeaders)){
			self::$httpHeaders=array();
			$httpHeaders=$_SERVER;
			foreach($httpHeaders as $key=>$value)
				if(substr($key,0,5)=='HTTP_')
                			self::$httpHeaders[$key]=$value;
			}
		}
1367832
public function send()
    {
        $this->sendHeaders();
        $this->sendContent();

        if (function_exists('fastcgi_finish_request')) {
            fastcgi_finish_request();
        } elseif ('cli' !== PHP_SAPI) {
            static::closeOutputBuffers(0, true);
        }

        return $this;
    }
1281279
public function setHeader($header)
    {
        $headers = [];

        if (is_array($header)) {
            foreach ($header as $key => $value) {
                $headers[] = $key . ': ' . $value;
            }
        } else {
            $headers[] = $header;
        }

        $this->setOpt(CURLOPT_HTTPHEADER, $headers);

        return $this;
    }