Fully Qualified Name: | Zend\Http\Client\Adapter\Socket |
Implements: | AdapterInterface, StreamInterface |
A sockets based (stream\socket\client) adapter class for Zend\Http\Client. Can be used on almost every PHP environment, and does not require any special extensions.
Name | Description | Defined By |
---|---|---|
__construct() | Adapter constructor, currently empty. Config is set using setOptions() | Socket |
__destruct() | Destructor: make sure the socket is disconnected | Socket |
close() | Close the connection to the server | Socket |
connect() | Connect to the remote server | Socket |
getConfig() | Retrieve the array of all configuration options | Socket |
getStreamContext() | Get the stream context for the TCP connection to the server. | Socket |
read() | Read response from server | Socket |
setOptions() | Set the configuration array for the adapter | Socket |
setOutputStream() | Set output stream for the response | Socket |
setStreamContext() | Set the stream context for the TCP connection to the server | Socket |
write() | Send request to the remote server | Socket |
Adapter constructor, currently empty. Config is set using setOptions()
Returns:
Destructor: make sure the socket is disconnected
If we are in persistent TCP mode, will not close the connection
Returns:
Close the connection to the server
Returns:
Connect to the remote server
Parameter Name | Type | Description |
---|---|---|
$host | string | |
$port | int | |
$secure | bool |
Returns:
Retrieve the array of all configuration options
Returns: array
Get the stream context for the TCP connection to the server.
If no stream context is set, will create a default one.
Returns: resource
Read response from server
Returns: string
Set the configuration array for the adapter
Parameter Name | Type | Description |
---|---|---|
$options | array|\Traversable |
Returns:
Set output stream for the response
Parameter Name | Type | Description |
---|---|---|
$stream | resource |
Returns: \Zend\Http\Client\Adapter\Socket
Set the stream context for the TCP connection to the server
Can accept either a pre-existing stream context resource, or an array of stream options, similar to the options array passed to the stream_context_create() PHP function. In such case a new stream context will be created using the passed options.
Parameter Name | Type | Description |
---|---|---|
$context | mixed | Stream |
Returns: \Socket
Send request to the remote server
Parameter Name | Type | Description |
---|---|---|
$method | string | |
$uri | \Zend\Uri\Uri | |
$httpVer | string | |
$headers | array | |
$body | string |
Returns: string Request as string