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

Class: HTTP_Header

Source Location: /HTTP_Header-0.3.0/Header.php

Class Overview

HTTP
   |
   --HTTP_Header

HTTP_Header


Author(s):

Version:

  • $Revision: 1.19 $

Methods


Child classes:

HTTP_Header_Cache
HTTP_Header

Inherited Variables

Inherited Methods


Class Details

[line 109]
HTTP_Header
  • Version: $Revision: 1.19 $
  • Access: public


[ Top ]


Method Detail

HTTP_Header (Constructor)   [line 141]

object HTTP_Header HTTP_Header( )

Constructor

Sets HTTP version.

  • Access: public

[ Top ]

dateToTimestamp   [line 311]

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:
  • Access: public

Parameters:

string   $date   —  The GMT date.

[ Top ]

getHeader   [line 220]

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

string getHttpVersion( )

Get HTTP version
  • Access: public

[ Top ]

getStatusText   [line 424]

string|false getStatusText( int $http_code)

Return Status Code Message

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

getStatusType   [line 398]

int|false getStatusType( int $http_code)

Return HTTP Status Code Type

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

isClientError   [line 484]

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

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

boolean isInformational( int $http_code)

Checks if HTTP Status code is Information (1xx)

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

isRedirect   [line 470]

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

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

boolean isSuccessful( int $http_code)

Checks if HTTP Status code is Successful (2xx)

Parameters:

int   $http_code   —  HTTP Code to check

[ Top ]

redirect   [line 358]

void redirect( [string $url = null], [mixed $param = null])

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.
mixed   $param   —  Possible values:
  • null (default) - only the session-id will be added, but only when trans_sid is enabled.
  • false - no parameters to add
  • true - add the session-id
  • array - of parameter names, if the key is a string it's assumed to be name => value, otherwise the value is retreived using $GLOBALS['paraName'].

[ Top ]

sendHeaders   [line 248]

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

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

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.

[ Top ]

setHttpVersion   [line 156]

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 13:51:31 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.