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

Class: Microsoft_Http_Response

Source Location: /Http/Response.php

Class Overview


Microsoft_Http_Response


Author(s):

Copyright:

  • Copyright (c) 2009, RealDolmen (http://www.realdolmen.com)

Variables

Methods



Class Details

[line 50]
Microsoft_Http_Response

This class is partially based on Zend Framework Zend_Http_Response - http://framework.zend.com




Tags:

copyright:  Copyright (c) 2009, RealDolmen (http://www.realdolmen.com)
license:  http://phpazure.codeplex.com/license


[ Top ]


Class Variables

static $_statusMessages = array(
        // Informational 1xx
        100 => 'Continue',
        101 => 'Switching Protocols',

        // Success 2xx
        200 => 'OK',
        201 => 'Created',
        202 => 'Accepted',
        203 => 'Non-Authoritative Information',
        204 => 'No Content',
        205 => 'Reset Content',
        206 => 'Partial Content',

        // Redirection 3xx
        300 => 'Multiple Choices',
        301 => 'Moved Permanently',
        302 => 'Found',  // 1.1
        303 => 'See Other',
        304 => 'Not Modified',
        305 => 'Use Proxy',
        // 306 is deprecated but reserved
        307 => 'Temporary Redirect',

        // Client Error 4xx
        400 => 'Bad Request',
        401 => 'Unauthorized',
        402 => 'Payment Required',
        403 => 'Forbidden',
        404 => 'Not Found',
        405 => 'Method Not Allowed',
        406 => 'Not Acceptable',
        407 => 'Proxy Authentication Required',
        408 => 'Request Timeout',
        409 => 'Conflict',
        410 => 'Gone',
        411 => 'Length Required',
        412 => 'Precondition Failed',
        413 => 'Request Entity Too Large',
        414 => 'Request-URI Too Long',
        415 => 'Unsupported Media Type',
        416 => 'Requested Range Not Satisfiable',
        417 => 'Expectation Failed',

        // Server Error 5xx
        500 => 'Internal Server Error',
        501 => 'Not Implemented',
        502 => 'Bad Gateway',
        503 => 'Service Unavailable',
        504 => 'Gateway Timeout',
        505 => 'HTTP Version Not Supported',
        509 => 'Bandwidth Limit Exceeded'
    )

[line 57]

List of all known HTTP response status codes



Tags:

access:  protected

Type:   array


[ Top ]

$_body =

[line 145]

The HTTP response body



Tags:

access:  protected

Type:   string


[ Top ]

$_code =

[line 123]

The HTTP response code



Tags:

access:  protected

Type:   int


[ Top ]

$_headers = array()

[line 138]

The HTTP response headers array



Tags:

access:  protected

Type:   array


[ Top ]

$_message =

[line 131]

The HTTP response code as string (e.g. 'Not Found' for 404 or 'Internal Server Error' for 500)



Tags:

access:  protected

Type:   string


[ Top ]

$_version =

[line 116]

The HTTP version (1.0, 1.1)



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


static method extractBody [line 400]

static string extractBody( $responseString, string $response_str)

Extract the body from a response string



Tags:

access:  public


Parameters:

string   $response_str  
   $responseString  

[ Top ]

static method extractCode [line 297]

static int extractCode( string $responseString)

Extract the response code from a response string



Tags:

access:  public


Parameters:

string   $responseString  

[ Top ]

static method extractHeaders [line 348]

static array extractHeaders( string $responseString)

Extract the headers from a response string



Tags:

access:  public


Parameters:

string   $responseString  

[ Top ]

static method extractMessage [line 314]

static string extractMessage( string $responseString)

Extract the HTTP message from a response



Tags:

access:  public


Parameters:

string   $responseString  

[ Top ]

static method extractVersion [line 331]

static string extractVersion( string $responseString)

Extract the HTTP version from a response



Tags:

access:  public


Parameters:

string   $responseString  

[ Top ]

static method fromString [line 415]

static Microsoft_Http_Response fromString( string $response_str)

Create a new Microsoft_Http_Response object from a string



Tags:

access:  public


Parameters:

string   $response_str  

[ Top ]

constructor __construct [line 156]

Microsoft_Http_Response __construct( int $code, array $headers, [string $body = null], [string $version = '1.1'])

HTTP response constructor



Tags:

throws:  Microsoft_Http_Exception
access:  public


Parameters:

int   $code   Response code (200, 404, 500, ...)
array   $headers   Headers array
string   $body   Response body
string   $version   HTTP version

[ Top ]

method getBody [line 286]

string getBody( )

The HTTP response body



Tags:

access:  public


[ Top ]

method getCode [line 237]

int getCode( )

Get the HTTP response code



Tags:

access:  public


[ Top ]

method getHeader [line 273]

string|array|null getHeader( string $header)

Get a specific header as string, or null if it is not set



Tags:

access:  public


Parameters:

string   $header  

[ Top ]

method getHeaders [line 258]

array getHeaders( )

Get the HTTP response headers array



Tags:

access:  public


[ Top ]

method getMessage [line 248]

string getMessage( )

Get the HTTP response code as string (e.g. 'Not Found' for 404 or 'Internal Server Error' for 500)



Tags:

access:  public


[ Top ]

method getVersion [line 227]

string getVersion( )

Get the HTTP version (1.0, 1.1)



Tags:

access:  public


[ Top ]

method isError [line 194]

boolean isError( )

Check whether the response is an error



Tags:

access:  public


[ Top ]

method isRedirect [line 216]

boolean isRedirect( )

Check whether the response is a redirection



Tags:

access:  public


[ Top ]

method isSuccessful [line 205]

boolean isSuccessful( )

Check whether the response in successful



Tags:

access:  public


[ Top ]


Documentation generated on Thu, 26 Nov 2009 08:05:13 +0100 by phpDocumentor 1.4.3