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

Class: HTTP_Header

Source Location: /HTTP_Header-1.2.1/HTTP/Header.php

Class Overview

HTTP
   |
   --HTTP_Header

HTTP_Header


Author(s):

Version:

  • $Revision: 304418 $

Variables

Methods


Child classes:

HTTP_Header_Cache
HTTP_Header_Cache

Inherited Variables

Inherited Methods


Class Details

[line 110]
HTTP_Header
  • Version: $Revision: 304418 $
  • Access: public


[ Top ]


Class Variables

$prettify =  false

[line 138]

  • Access: public

Type:   bool


[ Top ]



Method Detail

HTTP_Header (Constructor)   [line 148]

object HTTP_Header HTTP_Header( )

Constructor

Sets HTTP version.

  • Access: public

[ Top ]

dateToTimestamp   [line 326]

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 231]

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 179]

string getHttpVersion( )

Get HTTP version
  • Access: public

[ Top ]

getStatusText   [line 439]

string|false getStatusText( int $http_code)

Return Status Code Message

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

getStatusType   [line 413]

int|false getStatusType( int $http_code)

Return HTTP Status Code Type

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

isClientError   [line 499]

boolean isClientError( int $http_code)

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

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

isError   [line 527]

boolean isError( int $http_code)

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

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

isInformational   [line 457]

boolean isInformational( int $http_code)

Checks if HTTP Status code is Information (1xx)

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

isRedirect   [line 485]

boolean isRedirect( int $http_code)

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

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

isServerError   [line 513]

boolean isServerError( int $http_code)

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

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

isSuccessful   [line 471]

boolean isSuccessful( int $http_code)

Checks if HTTP Status code is Successful (2xx)

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

redirect   [line 370]

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 HTTP::redirect() you can also add parameters to the url.

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

  • Author: Wolfram Kriesing <wk@visionp.de>
  • See: HTTP::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 259]

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).


Parameters:

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

[ Top ]

setHeader   [line 196]

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

Set Header

The default value for the Last-Modified header will be current date and atime 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 163]

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 ]


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