Fully Qualified Name: | Laminas\Http\Client |
Implements: | DispatchableInterface |
Http client
Name | Description | Defined By |
---|---|---|
__construct() | Constructor | Client |
addCookie() | Add a cookie | Client |
clearAuth() | Clear http authentication | Client |
clearCookies() | Clear all the cookies | Client |
dispatch() | Dispatch | Client |
encodeAuthHeader() | Create a HTTP authentication "Authorization:" header according to the specified user, password and authentication method. | Client |
encodeFormData() | Encode data to a multipart/form-data part suitable for a POST request. | Client |
getAdapter() | Load the connection adapter | Client |
getArgSeparator() | Get the query string argument separator | Client |
getCookies() | Return the current cookies | Client |
getEncType() | Get the encoding type | Client |
getHeader() | Get the header value of the request | Client |
getLastRawRequest() | Get the last request (as a string) | Client |
getLastRawResponse() | Get the last response (as a string) | Client |
getMethod() | Get the HTTP method | Client |
getRedirectionsCount() | Get the redirections count | Client |
getRequest() | Get Request | Client |
getResponse() | Get Response | Client |
getStream() | Get status of streaming for received data | Client |
getUri() | Get uri (from the request) | Client |
hasHeader() | Check if exists the header type specified | Client |
removeFileUpload() | Remove a file to upload | Client |
reset() | Fully reset the HTTP client (auth, cookies, request, response, etc.) | Client |
resetParameters() | Reset all the HTTP parameters (request, response, etc) | Client |
send() | Send HTTP request | Client |
setAdapter() | Load the connection adapter | Client |
setArgSeparator() | Set the query string argument separator | Client |
setAuth() | Create a HTTP authentication "Authorization:" header according to the specified user, password and authentication method. | Client |
setCookies() | Set an array of cookies | Client |
setEncType() | Set the encoding type and the boundary (if any) | Client |
setFileUpload() | Set a file to upload (using a POST request) | Client |
setHeaders() | Set the headers (for the request) | Client |
setMethod() | Set the HTTP method (to the request) | Client |
setOptions() | Set configuration parameters for this HTTP client | Client |
setParameterGet() | Set the GET parameters | Client |
setParameterPost() | Set the POST parameters | Client |
setRawBody() | Set raw body (for advanced use cases) | Client |
setRequest() | Set request | Client |
setResponse() | Set response | Client |
setStream() | Set streaming for received data | Client |
setUri() | Set Uri (to the request) | Client |
Constructor
Parameter Name | Type | Description |
---|---|---|
$uri | string | |
$options | array|\Traversable |
Returns:
Add a cookie
Parameter Name | Type | Description |
---|---|---|
$cookie | array|\ArrayIterator|\Header\SetCookie|string | |
$value | string | |
$expire | string | |
$path | string | |
$domain | string | |
$secure | bool | |
$httponly | bool | |
$maxAge | string | |
$version | string |
Returns: $this
Clear http authentication
Returns:
Clear all the cookies
Returns:
Dispatch
Parameter Name | Type | Description |
---|---|---|
$request | \Stdlib\RequestInterface | |
$response | \Stdlib\ResponseInterface |
Returns: \Stdlib\ResponseInterface
Create a HTTP authentication "Authorization:" header according to the specified user, password and authentication method.
Parameter Name | Type | Description |
---|---|---|
$user | string | |
$password | string | |
$type | string |
Returns: string
Encode data to a multipart/form-data part suitable for a POST request.
Parameter Name | Type | Description |
---|---|---|
$boundary | string | |
$name | string | |
$value | mixed | |
$filename | string | |
$headers | array | Associative |
Returns: string
Load the connection adapter
Returns: \Client\Adapter\AdapterInterface
Get the query string argument separator
Returns: string
Return the current cookies
Returns: array
Get the encoding type
Returns: string
Get the header value of the request
Parameter Name | Type | Description |
---|---|---|
$name | string |
Returns: string|bool
Get the last request (as a string)
Returns: string
Get the last response (as a string)
Returns: string
Get the HTTP method
Returns: string
Get the redirections count
Returns: int
Get Request
Returns: \Request
Get Response
Returns: \Response
Get status of streaming for received data
Returns: bool|string
Get uri (from the request)
Returns: \Http
Check if exists the header type specified
Parameter Name | Type | Description |
---|---|---|
$name | string |
Returns: bool
Remove a file to upload
Parameter Name | Type | Description |
---|---|---|
$filename | string |
Returns: bool
Fully reset the HTTP client (auth, cookies, request, response, etc.)
Returns: $this
Reset all the HTTP parameters (request, response, etc)
Parameter Name | Type | Description |
---|---|---|
$clearCookies | bool | Also |
$clearAuth | bool | Also |
Returns: $this
Send HTTP request
Parameter Name | Type | Description |
---|---|---|
$request | \Request|null |
Returns: \Response
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
Parameter Name | Type | Description |
---|---|---|
$adapter | \Client\Adapter\AdapterInterface|string |
Returns: $this
Set the query string argument separator
Parameter Name | Type | Description |
---|---|---|
$argSeparator | string |
Returns: $this
Create a HTTP authentication "Authorization:" header according to the specified user, password and authentication method.
Parameter Name | Type | Description |
---|---|---|
$user | string | |
$password | string | |
$type | string |
Returns: $this
Set an array of cookies
Parameter Name | Type | Description |
---|---|---|
$cookies | array|\SetCookie[] | Cookies |
Returns: $this
Set the encoding type and the boundary (if any)
Parameter Name | Type | Description |
---|---|---|
$encType | string | |
$boundary | string |
Returns: $this
Set a file to upload (using a POST request)
Can be used in two ways:
Parameter Name | Type | Description |
---|---|---|
$filename | string | Name |
$formname | string | Name |
$data | string | Data |
$ctype | string | Content |
Returns: $this
Set the headers (for the request)
Parameter Name | Type | Description |
---|---|---|
$headers | \Headers|array |
Returns: $this
Set the HTTP method (to the request)
Parameter Name | Type | Description |
---|---|---|
$method | string |
Returns: $this
Set configuration parameters for this HTTP client
Parameter Name | Type | Description |
---|---|---|
$options | array|\Traversable |
Returns: $this
Set the GET parameters
Parameter Name | Type | Description |
---|---|---|
$query | array |
Returns: $this
Set the POST parameters
Parameter Name | Type | Description |
---|---|---|
$post | array |
Returns: $this
Set raw body (for advanced use cases)
Parameter Name | Type | Description |
---|---|---|
$body | string |
Returns: $this
Set request
Parameter Name | Type | Description |
---|---|---|
$request | \Request |
Returns: $this
Set response
Parameter Name | Type | Description |
---|---|---|
$response | \Response |
Returns: $this
Set streaming for received data
Parameter Name | Type | Description |
---|---|---|
$streamfile | string|bool | Stream |
Returns: $this
Set Uri (to the request)
Parameter Name | Type | Description |
---|---|---|
$uri | string|\Http |
Returns: $this