Horde\Socket\Client::gets PHP Метод

gets() публичный Метод

Returns a line of data.
public gets ( integer $size ) : string
$size integer Reading ends when $size - 1 bytes have been read, or a newline or an EOF (whichever comes first).
Результат string $size bytes of data from the socket
    public function gets($size)
    {
        $this->_checkStream();
        $data = @fgets($this->_stream, $size);
        if ($data === false) {
            throw new Client\Exception('Error reading data from socket');
        }
        return $data;
    }

Usage Example

Пример #1
0
 /**
  * Receives a single line from the server.
  *
  * @return string  The server response line.
  */
 protected function _recvLn()
 {
     $lastline = rtrim($this->_sock->gets(8192));
     $this->_debug("S: {$lastline}");
     if ($lastline === '') {
         throw new Exception('Failed to read from socket');
     }
     return $lastline;
 }