Class HTTP_Status

Description

HTTP Status class

PHP class for determining HTTP Status codes.

This class is mainly based on Status.pm <http://search.cpan.org/author/GAAS/libwww-perl-5.65/ lib/HTTP/Status.pm> from the libwww-perl collection <http://www.linpro.no/lwp/>.

This file will also define the following constants:

 - RC_CONTINUE                         (100)
 - RC_SWITCHING_PROTOCOLS              (101)
 - RC_PROCESSING                       (102)

 - RC_OK                               (200)
 - RC_CREATED                          (201)
 - RC_ACCEPTED                         (202)
 - RC_NON_AUTHORITATIVE_INFORMATION    (203)
 - RC_NO_CONTENT                       (204)
 - RC_RESET_CONTENT                    (205)
 - RC_PARTIAL_CONTENT                  (206)
 - RC_MULTI_STATUS                     (207)

 - RC_MULTIPLE_CHOICES                 (300)
 - RC_MOVED_PERMANENTLY                (301)
 - RC_FOUND                            (302)
 - RC_SEE_OTHER                        (303)
 - RC_NOT_MODIFIED                     (304)
 - RC_USE_PROXY                        (305)
 - RC_TEMPORARY_REDIRECT               (307)

 - RC_BAD_REQUEST                      (400)
 - RC_UNAUTHORIZED                     (401)
 - RC_PAYMENT_REQUIRED                 (402)
 - RC_FORBIDDEN                        (403)
 - RC_NOT_FOUND                        (404)
 - RC_METHOD_NOT_ALLOWED               (405)
 - RC_NOT_ACCEPTABLE                   (406)
 - RC_PROXY_AUTHENTICATION_REQUIRED    (407)
 - RC_REQUEST_TIMEOUT                  (408)
 - RC_CONFLICT                         (409)
 - RC_GONE                             (410)
 - RC_LENGTH_REQUIRED                  (411)
 - RC_PRECONDITION_FAILED              (412)
 - RC_REQUEST_ENTITY_TOO_LARGE         (413)
 - RC_REQUEST_URI_TOO_LARGE            (414)
 - RC_UNSUPPORTED_MEDIA_TYPE           (415)
 - RC_REQUEST_RANGE_NOT_SATISFIABLE    (416)
 - RC_EXPECTATION_FAILED               (417)
 - RC_UNPROCESSABLE_ENTITY             (422)
 - RC_LOCKED                           (423)
 - RC_FAILED_DEPENDENCY                (424)

 - RC_INTERNAL_SERVER_ERROR            (500)
 - RC_NOT_IMPLEMENTED                  (501)
 - RC_BAD_GATEWAY                      (502)
 - RC_SERVICE_UNAVAILABLE              (503)
 - RC_GATEWAY_TIMEOUT                  (504)
 - RC_HTTP_VERSION_NOT_SUPPORTED       (505)
 - RC_INSUFFICIENT_STORAGE             (507)
 

Example:


1 $code = $response->get_status_code();
2 echo HTTP_Status::get_message($code);
3 if (HTTP_Status::is_error($code)) echo 'Failed :(';

Located in Program_Root/HTTP_Status.php (line 102)


	
			
Method Summary
string get_message (int $code)
bool is_client_error (int $code)
bool is_error (int $code)
bool is_info (int $code)
bool is_redirect (int $code)
bool is_server_error (int $code)
bool is_success (int $code)
Methods
get_message (line 112)

Get status message

This method will translate status codes to human readable strings. If the $code is unknown, false is returned.

string get_message (int $code)
  • int $code:

    status code

is_client_error (line 221)

Is client error

This class of status code is intended for cases in which the client seems to have erred.

bool is_client_error (int $code)
  • int $code:

    status code

is_error (line 208)

Is error

Returns true for both client or server error status codes.

bool is_error (int $code)
  • int $code:

    status code

is_info (line 173)

Is info

This class of status code indicates a provisional response which can't have any content.

bool is_info (int $code)
  • int $code:

    status code

is_redirect (line 196)

Is redirect

This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request.

bool is_redirect (int $code)
  • int $code:

    status code

is_server_error (line 234)

Is server error

This class of status codes is intended for cases in which the server is aware that it has erred or is incapable of performing the request.

bool is_server_error (int $code)
  • int $code:

    status code

is_success (line 183)

Is success

bool is_success (int $code)
  • int $code:

    status code

Documention generated on Wed, 16 Jul 2003 01:03:34 +0100 by phpDocumentor 1.2.0