HTTP_Header2
[ class tree: HTTP_Header2 ] [ index: HTTP_Header2 ] [ all elements ]

Class: HTTP_Header2

Source Location: /HTTP_Header2-0.1.0/HTTP/Header2.php

Class Overview

HTTP2
   |
   --HTTP_Header2

HTTP_Header2


Author(s):

Version:

  • $Revision$

Variables

Methods


Child classes:

HTTP_Header2_Cache
HTTP_Header2_Cache

Inherited Variables

Inherited Methods


Class Details

[line 37]
HTTP_Header2


[ Top ]


Class Variables

$prettify =  false

[line 143]

  • Access: public

Type:   bool


[ Top ]



Method Detail

dateToTimestamp   [line 327]

mixed dateToTimestamp( string $date)

Date to Timestamp

Converts dates like Mon, 31 Mar 2003 15:26:34 GMT Tue, 15 Nov 1994 12:45:26 GMT into a timestamp, strtotime() didn't do it in older versions.

  • Return: Returns int unix timestamp or false if the date doesn't seem to be a valid GMT date.
  • Deprecated: Use PHPs strtotime() instead.
  • Access: public

Parameters:

string   $date   —  The GMT date.

[ Top ]

getHeader   [line 233]

mixed getHeader( [string $key = null])

Get Header

If $key is omitted, all stored headers will be returned.

  • Return: Returns string value of the requested header, array values of all headers or false if header $key is not set.
  • Access: public

Parameters:

string   $key   —  The name of the header to fetch.

[ Top ]

getHttpVersion   [line 182]

string getHttpVersion( )

Get HTTP version
  • Access: public

[ Top ]

getStatusText   [line 453]

string|false getStatusText( string $http_code)

Return Status Code Message

Parameters:

string   $http_code   —  HTTP status code

[ Top ]

getStatusType   [line 423]

int|false getStatusType( string $http_code)

Return HTTP Status Code Type

Parameters:

string   $http_code   —  HTTP status code

[ Top ]

isClientError   [line 521]

boolean isClientError( string $http_code)

Checks if HTTP Status code is a Client Error (4xx)

Parameters:

string   $http_code   —  HTTP status code

[ Top ]

isError   [line 553]

boolean isError( string $http_code)

Checks if HTTP Status code is Server OR Client Error (4xx or 5xx)

Parameters:

string   $http_code   —  HTTP status code

[ Top ]

isInformational   [line 473]

boolean isInformational( string $http_code)

Checks if HTTP Status code is Information (1xx)

Parameters:

string   $http_code   —  HTTP status code

[ Top ]

isRedirect   [line 505]

boolean isRedirect( string $http_code)

Checks if HTTP Status code is a Redirect (3xx)

Parameters:

string   $http_code   —  HTTP status code

[ Top ]

isServerError   [line 537]

boolean isServerError( string $http_code)

Checks if HTTP Status code is Server Error (5xx)

Parameters:

string   $http_code   —  HTTP status code

[ Top ]

isSuccessful   [line 489]

boolean isSuccessful( string $http_code)

Checks if HTTP Status code is Successful (2xx)

Parameters:

string   $http_code   —  HTTP status code

[ Top ]

redirect   [line 379]

void redirect( [string $url = null], [array $param = array()], [bool $session = false])

Redirect

This function redirects the client. This is done by issuing a Location header and exiting. Additionally to HTTP2::redirect() you can also add parameters to the url.

If you dont need parameters to be added, simply use HTTP2::redirect() otherwise use HTTP_Header2::redirect().

  • Author: Wolfram Kriesing <wk@visionp.de>
  • See: HTTP2::redirect()
  • Access: public

Parameters:

string   $url   —  The URL to redirect to, if none is given it redirects to the current page.
array   $param   —  Array of query string parameters to add; usually a set of key => value pairs; if an array entry consists only of an value it is used as key and the respective value is fetched from $GLOBALS[$value]
bool   $session   —  Whether the session name/id should be added

[ Top ]

sendHeaders   [line 261]

bool sendHeaders( [array $keys = array()], [array $include = true])

Send Headers

Send out the header that you set via setHeader().

  • Return: Returns true on success or false if headers are already sent.
  • Access: public

Parameters:

array   $keys   —  Headers to (not) send, see $include.
array   $include   —  If true only $keys matching headers will be sent, if false only header not matching $keys will be sent.

[ Top ]

sendStatusCode   [line 294]

bool sendStatusCode( int $code)

Send Satus Code

Send out the given HTTP-Status code. Use this for example when you want to tell the client this page is cached, then you would call sendStatusCode(304). {@see HTTP_Header2_Cache::exitIfCached()}

  • Return: Returns true on success or false if headers are already sent.
  • Access: public

Parameters:

int   $code   —  The status code to send, i.e. 404, 304, 200, etc.

[ Top ]

setHeader   [line 199]

bool setHeader( string $key, [string $value = null])

Set Header

The default value for the Last-Modified header will be current date and time if $value is omitted.

  • Return: Returns true on success or false if $key was empty or $value was not of an scalar type.
  • Access: public

Parameters:

string   $key   —  The name of the header.
string   $value   —  The value of the header. (NULL to unset header)

[ Top ]

setHttpVersion   [line 167]

bool setHttpVersion( mixed $version)

Set HTTP version
  • Return: Returns true on success or false if version doesn't match 1.0 or 1.1 (note: 1 will result in 1.0)
  • Access: public

Parameters:

mixed   $version   —  HTTP version, either 1.0 or 1.1

[ Top ]

__construct (Constructor)   [line 152]

object HTTP_Header2 __construct( )

Constructor

Sets HTTP version.

  • Access: public

Overridden in child classes as:

HTTP_Header2_Cache::__construct()
Constructor

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:48:38 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.