HTTP request that sends an entity-body in the request message (POST, PUT,
PATCH, DELETE)
Methods summary
public
|
#
__construct( string $method, string|Url $url, array|Collection $headers = array() )
Create a new request
Parameters
- $method
string $method HTTP method
- $url
string|Url $url HTTP URL to connect to. The URI scheme, host header, and URI are parsed
from the full URL. If query string parameters are present they will be parsed as
well.
- $headers
array|Collection $headers HTTP headers
Overrides
|
public
string
|
#
__toString( )
Get the HTTP request as a string
Get the HTTP request as a string
Returns
string
Overrides
Implementation of
|
public
Guzzle\Http\Message\RequestInterface
|
#
setState( string $state, array $context = array() )
Set the state of the request
Set the state of the request
Parameters
- $state
string $state State of the request (complete, sending, or new)
- $context
array $context Contextual information about the state change
Returns
Overrides
Implementation of
|
public
Guzzle\Http\Message\EntityEnclosingRequestInterface
|
#
setBody( string|resource|Guzzle\Http\EntityBodyInterface $body, string $contentType = null, boolean $tryChunkedTransfer = false )
Set the body of the request
Set the body of the request
Parameters
- $body
string|resource|Guzzle\Http\EntityBodyInterface $body Body to use in the entity body of the request
- $contentType
string $contentType Content-Type to set. Leave null to use an existing Content-Type or
to guess the Content-Type
- $tryChunkedTransfer
boolean $tryChunkedTransfer Try to use chunked Transfer-Encoding
Returns
Throws
Implementation of
|
public
Guzzle\Http\EntityBodyInterface |null
|
#
getBody( )
Get the body of the request if set
Get the body of the request if set
Returns
Implementation of
|
public
Guzzle\Http\Message\EntityEnclosingRequest
|
#
configureRedirects( boolean $strict = false, integer $maxRedirects = 5 )
Configure how redirects are handled for the request
Configure how redirects are handled for the request
Parameters
- $strict
boolean $strict Set to true to follow strict RFC compliance when redirecting POST
requests. Most browsers with follow a 301-302 redirect for a POST request with a
GET request. This is the default behavior of Guzzle. Enable strict redirects to
redirect these responses with a POST rather than a GET request.
- $maxRedirects
integer $maxRedirects Specify the maximum number of allowed redirects. Set to 0 to
disable redirects.
Returns
Implementation of
|
public
mixed|null
|
#
getPostField( string $field )
Get a POST field from the request
Get a POST field from the request
Parameters
- $field
string $field Field to retrieve
Returns
mixed|null
Implementation of
|
public
Guzzle\Http\QueryString
|
#
getPostFields( )
Get the post fields that will be used in the request
Get the post fields that will be used in the request
Returns
Implementation of
|
public
Guzzle\Http\Message\EntityEnclosingRequestInterface
|
#
setPostField( string $key, string $value )
Set a POST field value
Parameters
- $key
string $key Key to set
- $value
string $value Value to set
Returns
Implementation of
|
public
Guzzle\Http\Message\EntityEnclosingRequestInterface
|
|
public
Guzzle\Http\Message\EntityEnclosingRequestInterface
|
#
removePostField( string $field )
Remove a POST field or file by name
Remove a POST field or file by name
Parameters
- $field
string $field Name of the POST field or file to remove
Returns
Implementation of
|
public
array
|
#
getPostFiles( )
Returns an associative array of POST field names to PostFileInterface
objects
Returns an associative array of POST field names to PostFileInterface
objects
Returns
array
Implementation of
|
public
array|null
|
#
getPostFile( string $fieldName )
Get a POST file from the request
Get a POST file from the request
Parameters
- $fieldName
string $fieldName POST fields to retrieve
Returns
array|null Returns an array wrapping an array of PostFileInterface objects
Implementation of
|
public
Guzzle\Http\Message\EntityEnclosingRequestInterface
|
#
removePostFile( string $fieldName )
Remove a POST file from the request
Remove a POST file from the request
Parameters
- $fieldName
string $fieldName POST file field name to remove
Returns
Implementation of
|
public
Guzzle\Http\Message\EntityEnclosingRequestInterface
|
#
addPostFile( string $field, string $filename = null, string $contentType = null )
Add a POST file to the upload
Add a POST file to the upload
Parameters
- $field
string $field POST field to use (e.g. file). Used to reference content from the server.
- $filename
string $filename Full path to the file. Do not include the @ symbol.
- $contentType
string $contentType Optional Content-Type to add to the Content-Disposition. Default
behavior is to guess. Set to false to not specify.
Returns
Implementation of
|
public
Guzzle\Http\Message\EntityEnclosingRequestInterface
|
#
addPostFiles( array $files )
Add POST files to use in the upload
Add POST files to use in the upload
Parameters
- $files
array $files An array of POST fields => filenames where filename can be a string or
PostFileInterface
Returns
Implementation of
|
protected
|
#
processPostFields( )
Determine what type of request should be sent based on post fields
Determine what type of request should be sent based on post fields
|