Zend\Http\Client\Adapter\Socket
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.
Synopsis
class Socket
implements
AdapterInterface,StreamInterface
{
- // members
- protected array $sslCryptoTypes;
- protected resource|null $socket;
- protected array $connectedTo;
- protected resource $outStream;
- protected array $config;
- protected string $method;
- protected resource $context;
- // methods
- public void __construct()
- public void setOptions()
- public array getConfig()
- public Socket setStreamContext()
- public resource getStreamContext()
- public void connect()
- public string write()
- public string read()
- public void close()
- protected void _checkSocketReadTimeout()
- public Socket setOutputStream()
- public void __destruct()
Hierarchy
Extended by
Implements
Members
protected
- $config
—
array
Parameters array - $connectedTo
—
array
What host/port are we connected to? - $context
—
resource
Stream context - $method
—
string
Request method - will be set by write() and might be used by read() - $outStream
—
resource
Stream for storing output - $socket
—
Zend\Http\Client\Adapter\resource|null
The socket for server connection - $sslCryptoTypes
—
array
Map SSL transport wrappers to stream crypto method constants
Methods
protected
- _checkSocketReadTimeout() — Check if the socket has timed out - if so close connection and throw an exception
public
- __construct() — Adapter constructor, currently empty. Config is set using setOptions()
- __destruct() — Destructor: make sure the socket is disconnected
- close() — Close the connection to the server
- connect() — Connect to the remote server
- getConfig() — Retrieve the array of all configuration options
- getStreamContext() — Get the stream context for the TCP connection to the server.
- read() — Read response from server
- setOptions() — Set the configuration array for the adapter
- setOutputStream() — Set output stream for the response
- setStreamContext() — Set the stream context for the TCP connection to the server
- write() — Send request to the remote server