STATE_NEW
STATE_NEW = 'new'
HTTP request that sends an entity-body in the request message (POST, PUT)
send() : \Guzzle\Http\Message\Response
Send the request
on a request error
setClient(\Guzzle\Http\ClientInterface $client) : self
Set the client used to transport the request
\Guzzle\Http\ClientInterface | $client |
getClient() : \Guzzle\Http\ClientInterface
Get the client used to transport the request
$client
getUrl(boolean $asObject = false) : string|\Guzzle\Http\Url
Get the full URL of the request (e.g. 'http://www.guzzle-project.com/')
boolean | $asObject | Set to TRUE to retrieve the URL as a clone of the URL object owned by the request. |
getQuery() : \Guzzle\Http\QueryString
Get the collection of key value pairs that will be used as the query string in the request
setAuth(string|boolean $user, string $password = '', string $scheme = 'Basic') : self
Set HTTP authorization parameters
string|boolean | $user | User name or false disable authentication |
string | $password | Password |
string | $scheme | Authentication scheme ('Basic', 'Digest', or a CURLAUTH_* constant (deprecated)) |
getResponse() : \Guzzle\Http\Message\Response|null
Get the previously received {@see Response} or NULL if the request has not been sent
setResponse(\Guzzle\Http\Message\Response $response, boolean $queued = false) : self
Manually set a response for the request.
This method is useful for specifying a mock response for the request or setting the response using a cache. Manually setting a response will bypass the actual sending of a request.
\Guzzle\Http\Message\Response | $response | Response object to set |
boolean | $queued | Set to TRUE to keep the request in a state of not having been sent, but queue the response for send() |
Returns a reference to the object.
startResponse(\Guzzle\Http\Message\Response $response) : self
The start of a response has been received for a request and the request is still in progress
\Guzzle\Http\Message\Response | $response | Response that has been received so far |
setResponseBody(\Guzzle\Http\EntityBodyInterface|string|resource $body) : \Guzzle\Http\Message\Request
Set the EntityBody that will hold a successful response message's entity body.
This method should be invoked when you need to send the response's entity body somewhere other than the normal php://temp buffer. For example, you can send the entity body to a socket, file, or some other custom stream.
\Guzzle\Http\EntityBodyInterface|string|resource | $body | Response body object. Pass a string to attempt to store the response body in a local file. |
getResponseBody() : \Guzzle\Http\EntityBodyInterface
Get the EntityBody that will hold the resulting response message's entity body. This response body will only be used for successful responses. Intermediate responses (e.g. redirects) will not use the targeted response body.
setState(string $state, array $context = array()) : string
Set the state of the request
string | $state | State of the request ('complete', 'transfer', 'new', 'error') |
array | $context | Contextual information about the state change |
Returns the current state of the request (which may have changed due to events being fired)
getCurlOptions() : \Guzzle\Common\Collection
Get the cURL options that will be applied when the cURL handle is created
getParams() : \Guzzle\Common\Collection
Get application and plugin specific parameters set on the message.
getHeader(string $header) : \Guzzle\Http\Message\Header|null
Retrieve an HTTP header by name. Performs a case-insensitive search of all headers.
string | $header | Header to retrieve. |
getHeaders() : \Guzzle\Http\Message\Header\HeaderCollection
Get all headers as a collection
setEventDispatcher(\Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher) : self
Set the EventDispatcher of the request
\Symfony\Component\EventDispatcher\EventDispatcherInterface | $eventDispatcher |
getEventDispatcher() : \Symfony\Component\EventDispatcher\EventDispatcherInterface
Get the EventDispatcher of the request
dispatch(string $eventName, array $context = array()) : \Guzzle\Common\Event
Helper to dispatch Guzzle events and set the event name on the event
string | $eventName | Name of the event to dispatch |
array | $context | Context of the event |
Returns the created event object
addSubscriber(\Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber) : self
Add an event subscriber to the dispatcher
\Symfony\Component\EventDispatcher\EventSubscriberInterface | $subscriber | Event subscriber |
setBody(string|resource|\Guzzle\Http\EntityBodyInterface $body, string $contentType = null) : self
Set the body of the request
string|resource|\Guzzle\Http\EntityBodyInterface | $body | Body to use in the entity body of the request |
string | $contentType | Content-Type to set. Leave null to use an existing Content-Type or to guess the Content-Type |
if the protocol is < 1.1 and Content-Length can not be determined
getBody() : \Guzzle\Http\EntityBodyInterface|null
Get the body of the request if set
getPostFields() : \Guzzle\Http\QueryString
Get the post fields that will be used in the request
addPostFields(\Guzzle\Http\QueryString|array $fields) : self
Add POST fields to use in the request
\Guzzle\Http\QueryString|array | $fields | POST fields |
addPostFile(string $field, string $filename = null, string $contentType = null, string $postname = null) : self
Add a POST file to the upload
string | $field | POST field to use (e.g. file). Used to reference content from the server. |
string | $filename | Full path to the file. Do not include the @ symbol. |
string | $contentType | Optional Content-Type to add to the Content-Disposition. Default behavior is to guess. Set to false to not specify. |
string | $postname | The name of the file, when posted. (e.g. rename the file) |
configureRedirects(boolean $strict = false, integer $maxRedirects = 5) : self
Configure how redirects are handled for the request
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. |
integer | $maxRedirects | Specify the maximum number of allowed redirects. Set to 0 to disable redirects. |