Result = WriteCGIHeader(Header$, Value$ [, Flags])
Writes a header to the CGI output. The headers needs to be written before any other data.


Header$ The header to write. It can be a custom or one of the following value:
  #PB_CGI_HeaderContentLength : the length (in bytes) of the output stream (implies binary data).
  #PB_CGI_HeaderContentType   : the MIME content type of the output stream.
  #PB_CGI_HeaderExpires       : date and time when the document is no longer valid 
                                and should be reloaded by the browser.
  #PB_CGI_HeaderLocation      : server redirection (cannot be sent as part of a complete header).
  #PB_CGI_HeaderPragma        : turns document caching on and off.
  #PB_CGI_HeaderStatus        : status of the request (cannot be sent as part of a complete header).
  #PB_CGI_HeaderContentDisposition : allows to specify a default filename when sending out a file.
  #PB_CGI_HeaderRefresh       : client reloads specified document.
  #PB_CGI_HeaderSetCookie     : client stores specified data, 
                                useful for keeping track of data between requests.
Value$ The header value to write.
Flags (optional) The string encoding to use. It can be one of the following value:
  #PB_Ascii (default)
Combined with one of the following value:
  #PB_CGI_LastHeader : This is the last header written, meaning no more headers can be sent. 
                       This flag is mandatory for the last header written.

Return value

Returns non-zero if the header has been successfully written to the CGI output.


  If Not InitCGI() Or Not ReadCGI()
  WriteCGIHeader(#PB_CGI_HeaderContentType, "text/html", #PB_CGI_LastHeader)
  WriteCGIString("<html><title>PureBasic - test</title><body>" +
                 "Hello from PureBasic CGI<br>" +

See Also

InitCGI(), WriteCGIFile(), WriteCGIStringN()

Supported OS


<- WriteCGIFile() - CGI Index - WriteCGIString() ->