Свойство | Тип | Описание | |
---|---|---|---|
$host | string | Either path for local FS or hostname for remote connection | |
$port | integer | Port to use if connected to a remote host | |
$scheme | string | Protocol to use | |
$timeout | integer | How long to wait for reply from the remote end (seconds) |
Метод | Описание | |
---|---|---|
__construct ( string $proto = "http", string $path = "localhost", integer $port = 8888, integer $timeout = 1 ) | Constructor. Instantiates the writer. | |
formatMessage ( array $data ) : string | Converts the data into backend acceptable format | |
send ( array $data ) : boolean | Formats and sends the data to a backend using the suitable method depending on protocol |
Метод | Описание | |
---|---|---|
sendRequest ( string $path = '/', string $body = '', array $queryData = [], array $headers = [], string $method = "POST", array $options = [], array $postFields = [] ) : http\Client\Response | Sends HTTP request with specified params. | |
sleepWait ( ) | Sleeps when an attempt to send data failed | |
writeFile ( string $message ) : boolean | Writes data to a local file | |
writeHttp ( string $message ) : boolean | Sends data over HTTP protocol | |
writeSocket ( string $message ) : boolean | Sends data over a socket, using one of TCP, UDP etc. protocols |
public __construct ( string $proto = "http", string $path = "localhost", integer $port = 8888, integer $timeout = 1 ) | ||
$proto | string | optional Protocol to use, e.g. http, tcp, udp. Optional. |
$path | string | optional Either a local FS path or hostname/IP for remote. |
$port | integer | optional Port to use if connected to a remote host. |
$timeout | integer | optional How long to wait for reply from the remote end. (seconds) |
public formatMessage ( array $data ) : string | ||
$data | array | Prepared array of data to convert into JSON format |
Результат | string | A JSON formatted string |
protected sendRequest ( string $path = '/', string $body = '', array $queryData = [], array $headers = [], string $method = "POST", array $options = [], array $postFields = [] ) : http\Client\Response | ||
$path | string | optional Path URL part |
$body | string | optional Raw request POST content |
$queryData | array | optional Associative array of query-string params |
$headers | array | optional Associative array of request headers |
$method | string | optional Request method |
$options | array | optional Request options |
$postFields | array | optional Associative array of post-fields |
Результат | http\Client\Response |
protected writeSocket ( string $message ) : boolean | ||
$message | string | A prepared message for sending |
Результат | boolean | Indicates whether operation was successful |
protected string $host | ||
Результат | string |
protected int $port | ||
Результат | integer |
protected int $timeout | ||
Результат | integer |