PHP Класс yii\httpclient\Request

С версии: 2.0
Автор: Paul Klimov ([email protected])
Наследование: extends Message
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
addContent ( string $name, string $content, array $options = [] ) Adds a content part for multi-part content request.
addData ( $data )
addFile ( string $name, string $fileName, array $options = [] ) Adds a file for upload as multi-part content.
addFileContent ( string $name, string $content, array $options = [] ) Adds a string as a file upload.
addOptions ( array $options ) Adds more options to already defined ones.
afterSend ( Response $response ) This method is invoked right after this request is sent.
beforeSend ( ) This method is invoked right before this request is sent.
composeHeaderLines ( )
getFullUrl ( ) : string Returns full target URL, including [[Client::baseUrl]] as a string.
getMethod ( ) : string
getOptions ( ) : array
getUrl ( ) : string | array Returns target URL.
prepare ( ) Prepares this request instance for sending.
send ( ) : Response Sends this request.
setData ( $data )
setMethod ( string $method )
setOptions ( array $options ) Following options are supported: - timeout: int, the maximum number of seconds to allow request to be executed.
setUrl ( string | array $url ) Sets target URL.
toString ( )

Приватные методы

Метод Описание
composeCookieHeader ( ) : string
composeFormInputs ( array $data, string $baseKey = '' ) : array Composes given data as form inputs submitted values, taking in account nested arrays.
createFullUrl ( array | string $url ) : string Normalizes given URL value, filling it with actual string URL value.
getFormatter ( ) : yii\httpclient\FormatterInterface
prepareMultiPartContent ( array $content ) Prepares multi-part content.

Описание методов

addContent() публичный Метод

Adds a content part for multi-part content request.
public addContent ( string $name, string $content, array $options = [] )
$name string part (form input) name.
$content string content.
$options array content part options, valid options are: - contentType - string, part content type - fileName - string, name of the uploading file - mimeType - string, part content type in case of file uploading

addData() публичный Метод

public addData ( $data )

addFile() публичный Метод

Adds a file for upload as multi-part content.
См. также: addContent()
public addFile ( string $name, string $fileName, array $options = [] )
$name string part (form input) name
$fileName string full name of the source file.
$options array content part options, valid options are: - fileName - string, base name of the uploading file, if not set it base name of the source file will be used. - mimeType - string, file mime type, if not set it will be determine automatically from source file.

addFileContent() публичный Метод

Adds a string as a file upload.
См. также: addContent()
public addFileContent ( string $name, string $content, array $options = [] )
$name string part (form input) name
$content string file content.
$options array content part options, valid options are: - fileName - string, base name of the uploading file. - mimeType - string, file mime type, if not set it 'application/octet-stream' will be used.

addOptions() публичный Метод

Please refer to Request::setOptions on how to specify options.
public addOptions ( array $options )
$options array additional options

afterSend() публичный Метод

The method will invoke [[Client::afterSend()]] and trigger the [[EVENT_AFTER_SEND]] event.
С версии: 2.0.1
public afterSend ( Response $response )
$response Response received response instance.

beforeSend() публичный Метод

The method will invoke [[Client::beforeSend()]] and trigger the [[EVENT_BEFORE_SEND]] event.
С версии: 2.0.1
public beforeSend ( )

composeHeaderLines() публичный Метод

public composeHeaderLines ( )

getFullUrl() публичный Метод

Returns full target URL, including [[Client::baseUrl]] as a string.
public getFullUrl ( ) : string
Результат string full target URL.

getMethod() публичный Метод

public getMethod ( ) : string
Результат string request method

getOptions() публичный Метод

public getOptions ( ) : array
Результат array request options.

getUrl() публичный Метод

Returns target URL.
public getUrl ( ) : string | array
Результат string | array target URL or URL parameters

prepare() публичный Метод

This method should be invoked by transport before sending a request. Do not call this method unless you know what you are doing.
public prepare ( )

send() публичный Метод

Sends this request.
public send ( ) : Response
Результат Response response instance.

setData() публичный Метод

public setData ( $data )

setMethod() публичный Метод

public setMethod ( string $method )
$method string request method

setOptions() публичный Метод

- proxy: string, URI specifying address of proxy server. (e.g. tcp://proxy.example.com:5100). - userAgent: string, the contents of the "User-Agent: " header to be used in a HTTP request. - followLocation: bool, whether to follow any "Location: " header that the server sends as part of the HTTP header. - maxRedirects: int, the max number of redirects to follow. - protocolVersion: float|string, HTTP protocol version. - sslVerifyPeer: bool, whether verification of the peer's certificate should be performed. - sslCafile: string, location of Certificate Authority file on local filesystem which should be used with the 'sslVerifyPeer' option to authenticate the identity of the remote peer. - sslCapath: string, a directory that holds multiple CA certificates. You may set options using keys, which are specific to particular transport, like [CURLOPT_VERBOSE => true] in case there is a necessity for it.
public setOptions ( array $options )
$options array request options.

setUrl() публичный Метод

Sets target URL.
public setUrl ( string | array $url )
$url string | array use a string to represent a URL (e.g. `http://some-domain.com`, `item/list`), or an array to represent a URL with query parameters (e.g. `['item/list', 'param1' => 'value1']`).

toString() публичный Метод

public toString ( )