Request_Driver Class

base class for request classes

package Fuel\Core

 Methods

__construct()

__construct($resource, array $options, $method) 

Parameters

$resource

$options

$method

Returns the body as a string.

__toString() : string

Returns

string

Add a single parameter/value or an array of parameters

add_param(string | array $param, mixed $value) : \Fuel\Core\Request_Driver

Parameters

$param

stringarray

$value

mixed

Returns

Executes the request upon the URL

execute(array $additional_params) : \Fuel\Core\Response

Parameters

$additional_params

array

Returns

Forge

forge(string $resource, array $options, mixed $method) : \Fuel\Core\Request_Driver

Parameters

$resource

string

$options

array

$method

mixed

Returns

Collect all headers and parse into consistent string

get_headers() : array

Returns

array

Returns the request method.

get_method() : string

Returns

stringrequest method

Fetch the response

response() : \Fuel\Core\Response

Fetch the response info or a key from it

response_info(string $key, string $default) : mixed

Parameters

$key

string

$default

string

Returns

mixed

Switch auto formatting on or off

set_auto_format(bool $auto_format) : \Fuel\Core\Request_Driver

Parameters

$auto_format

bool

Returns

set a request http header

set_header(string $header, string $content) : \Fuel\Core\Request_Driver

Parameters

$header

string

$content

string

Returns

Sets the request method.

set_method(string $method) : object

Parameters

$method

string

request method

Returns

objectcurrent instance

Set mime-type accept header

set_mime_type(string $mime) : string

Parameters

$mime

string

Returns

stringRequest_Driver

Sets a single option/value

set_option(int | string $option, mixed $value) : \Fuel\Core\Request_Driver

Parameters

$option

intstring

$value

mixed

Returns

Sets options on the driver

set_options(array $options) : \Fuel\Core\Request_Driver

Parameters

$options

array

Returns

Set the parameters to pass with the request

set_params(array $params) : \Fuel\Core\Request_Driver

Parameters

$params

array

Returns

Creates the Response and optionally attempts to auto-format the output

set_response(string $body, int $status, string $mime, array $headers, string $accept_header) : \Fuel\Core\Response

Parameters

$body

string

$status

int

$mime

string

$headers

array

$accept_header

string

Exceptions

\OutOfRangeException if an accept header was specified, but the mime type isn't in it

Returns

Validate if a given mime type is accepted according to an accept header

mime_in_header(string $mime, string $accept_header) : bool

Parameters

$mime

string

$accept_header

string

Returns

bool

Reset before doing another request

set_defaults() : \Fuel\Core\Request_Driver

 Properties

 

<p>mimetype format autodetection</p>

$auto_detect_formats : array

 

<p>whether to attempt auto-formatting the response</p>

$auto_format : bool

 

<p>options set during object creation are handled as the defaults</p>

$default_options : array

 

<p>params set during object creation are handled as the defaults</p>

$default_params : array

 

<p>http headers set for the request</p>

$headers : array

 

<p>request method</p>

$method : string

 

<p>driver specific options</p>

$options : array

 

<p>parameters to pass</p>

$params : array

 

<p>URL resource to perform requests upon</p>

$resource : string

 

<p>the response object after execute</p>

$response : \Fuel\Core\Response

 

<p>info about the response</p>

$response_info : array

 

<p>supported response formats</p>

$supported_formats : array