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

Class: HTTP_Request2_Adapter

Source Location: /HTTP_Request2-2.2.1/HTTP/Request2/Adapter.php

Class Overview

Base class for HTTP_Request2 adapters



  • Release: 2.2.1



Child classes:

Socket-based adapter for HTTP_Request2
Mock adapter intended for testing
Adapter for HTTP_Request2 wrapping around cURL extension

Inherited Variables

Inherited Methods

Class Details

[line 40]
Base class for HTTP_Request2 adapters

HTTP_Request2 class itself only defines methods for aggregating the request data, all actual work of sending the request to the remote server and receiving its response is performed by adapters.

[ Top ]

Class Variables

$bodyDisallowed = array('TRACE')

[line 46]

A list of methods that MUST NOT have a request body, per RFC 2616
  • Access: protected

Type:   array

[ Top ]

$bodyRequired = array('POST', 'PUT')

[line 58]

Methods having defined semantics for request body

Content-Length header (indicating that the body follows, section 4.3 of RFC 2616) will be sent for these methods even if no body was added

Type:   array

[ Top ]

$contentLength =

[line 77]

Length of the request body
  • Access: protected

Type:   integer

[ Top ]

$request =

[line 64]

Request being sent
  • Access: protected

Type:   HTTP_Request2

[ Top ]

$requestBody =

[line 71]

Request body

Type:   string|resource|HTTP_Request2_MultipartBody

[ Top ]

Method Detail

calculateRequestLength   [line 96]

void calculateRequestLength( array &$headers)

Calculates length of the request body, adds proper headers
  • Access: protected


array   &$headers   —  associative array of request headers, this method will add proper 'Content-Length' and 'Content-Type' headers to this array (or remove them if not needed)

[ Top ]

sendRequest   [line 87]

HTTP_Request2_Response sendRequest( HTTP_Request2 $request)

Sends request to the remote server and returns its response
  • Abstract:
  • Throws: HTTP_Request2_Exception
  • Access: public

Overridden in child classes as:

Sends request to the remote server and returns its response
Returns the next response from the queue built by addResponse()
Sends request to the remote server and returns its response


HTTP_Request2   $request   —  HTTP request message

[ Top ]

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