Http client
Set configuration parameters for this HTTP client
| Parameters: | array|Traversable – |
|---|---|
| Return type: | Client |
| Throws : | ClientExceptionInvalidArgumentException |
Load the connection adapter
While this method is not called more than one for a client, it is separated from ->request() to preserve logic and readability
| Parameters: | ClientAdapterAdapterInterface|string – |
|---|---|
| Return type: | Client |
| Throws : | ClientExceptionInvalidArgumentException |
Load the connection adapter
| Return type: | ClientAdapterAdapterInterface $adapter |
|---|
Get the last request (as a string)
| Return type: | string |
|---|
Get the last response (as a string)
| Return type: | string |
|---|
Get the redirections count
| Return type: | integer |
|---|
Set the HTTP method (to the request)
| Parameters: | string – |
|---|---|
| Return type: | Client |
Set the query string argument separator
| Parameters: | string – |
|---|---|
| Return type: | Client |
Get the query string argument separator
| Return type: | string |
|---|
Set the encoding type and the boundary (if any)
| Parameters: |
|
|---|---|
| Return type: | Client |
Set raw body (for advanced use cases)
| Parameters: | string – |
|---|---|
| Return type: | Client |
Set the POST parameters
| Parameters: | array – |
|---|---|
| Return type: | Client |
Set the GET parameters
| Parameters: | array – |
|---|---|
| Return type: | Client |
Get the cookie Id (name+domain+path)
| Parameters: | HeaderSetCookie|HeaderCookie – |
|---|---|
| Return type: | string|bool |
Add a cookie
| Parameters: |
|
|---|---|
| Throws ExceptionInvalidArgumentException: | |
| Return type: | Client |
Set an array of cookies
| Parameters: | array – |
|---|---|
| Throws ExceptionInvalidArgumentException: | |
| Return type: | Client |
Set the headers (for the request)
| Parameters: | Headers|array – |
|---|---|
| Throws ExceptionInvalidArgumentException: | |
| Return type: | Client |
Check if exists the header type specified
| Parameters: | string – |
|---|---|
| Return type: | bool |
Get the header value of the request
| Parameters: | string – |
|---|---|
| Return type: | string|bool |
Set streaming for received data
| Parameters: | string|bool – Stream file, true for temp file, false/null for no streaming |
|---|---|
| Return type: | ZendHttpClient |
Get status of streaming for received data
| Return type: | bool|string |
|---|
Create a HTTP authentication “Authorization:” header according to the specified user, password and authentication method.
| Parameters: |
|
|---|---|
| Throws ExceptionInvalidArgumentException: | |
| Return type: | Client |
Calculate the response value according to the HTTP authentication type
| Parameters: |
|
|---|---|
| Throws ExceptionInvalidArgumentException: | |
| Return type: | string|bool |
Reset all the HTTP parameters (auth,cookies,request, response, etc)
| Parameters: | bool – Also clear all valid cookies? (defaults to false) |
|---|---|
| Return type: | Client |
Dispatch
| Parameters: |
|
|---|---|
| Return type: | StdlibResponseInterface |
Send HTTP request
| Parameters: | Request – |
|---|---|
| Return type: | Response |
| Throws : | ExceptionRuntimeException |
| Throws : | ClientExceptionRuntimeException |
Set a file to upload (using a POST request)
Can be used in two ways:
1. $data is null (default): $filename is treated as the name if a local file which will be read and sent. Will try to guess the content type using mime_content_type(). 2. $data is set - $filename is sent as the file name, but $data is sent as the file contents and no file is read from the file system. In this case, you need to manually set the Content-Type ($ctype) or it will default to application/octet-stream.
| Parameters: |
|
|---|---|
| Return type: | Client |
| Throws : | ExceptionRuntimeException |
Remove a file to upload
| Parameters: | string – |
|---|---|
| Return type: | bool |
Prepare Cookies
| Parameters: |
|
|---|---|
| Return type: | HeaderCookie|bool |
Prepare the request headers
| Parameters: |
|
|---|---|
| Throws ExceptionRuntimeException: | |
| Return type: | array |
Prepare the request body (for PATCH, POST and PUT requests)
| Return type: | string |
|---|---|
| Throws : | ZendHttpClientExceptionRuntimeException |
Attempt to detect the MIME type of a file using available extensions
This method will try to detect the MIME type of a file. If the fileinfo extension is available, it will be used. If not, the mime_magic extension which is deprecated but is still available in many PHP setups will be tried.
If neither extension is available, the default application/octet-stream MIME type will be returned
| Parameters: | string – File path |
|---|---|
| Return type: | string MIME type |
Encode data to a multipart/form-data part suitable for a POST request.
| Parameters: |
|
|---|---|
| Return type: | string |
Convert an array of parameters into a flat array of (key, value) pairs
Will flatten a potentially multi-dimentional array of parameters (such as POST parameters) into a flat array of (key, value) paris. In case of multi-dimentional arrays, square brackets ([]) will be added to the key to indicate an array.
| Parameters: |
|
|---|---|
| Return type: | array |
@const string Supported HTTP Authentication methods
@const string POST data encoding methods
@const string DIGEST Authentication