public function exec()
    {
        $this->response = '';
        $errno = $errstr = null;

        if (isset($this->context)) {
            $this->stream = stream_socket_client($this->socket, $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $this->context);
        } else {
            $this->stream = stream_socket_client($this->socket, $errno, $errstr, $this->timeout);
        }

        if (!empty($errstr)) {
            throw new UnexpectedValueException($errstr);
        }

        fwrite($this->stream, $this->getRequestBody());

        while (!feof($this->stream)) {
            $this->response .= fgets($this->stream, 1024);
        }

        fclose($this->stream);
        $this->stream = null;

        return $this;
    }
public function exec()
    {
        $this->response = '';
        $errno = $errstr = null;

        if (isset($this->context)) {
            $this->stream = stream_socket_client($this->socket, $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $this->context);
        } else {
            $this->stream = stream_socket_client($this->socket, $errno, $errstr, $this->timeout);
        }

        if (!empty($errstr)) {
            throw new UnexpectedValueException($errstr);
        }

        fwrite($this->stream, $this->getRequestBody());

        while (!feof($this->stream)) {
            $this->response .= fgets($this->stream, 1024);
        }

        fclose($this->stream);
        $this->stream = null;

        return $this;
    }
public function exec ( ) { $ this -> response = '' ; $ errno = $ errstr = null ; if ( isset ( $ this -> context ) ) { $ this -> stream = stream_socket_client ( $ this -> socket , $ errno , $ errstr , $ this -> timeout , STREAM_CLIENT_CONNECT , $ this -> context ) ; } else { $ this -> stream = stream_socket_client ( $ this -> socket , $ errno , $ errstr , $ this -> timeout ) ; } if ( ! empty ( $ errstr ) ) { throw new UnexpectedValueException ( $ errstr ) ; } fwrite ( $ this -> stream , $ this -> getRequestBody ( ) ) ; while ( ! feof ( $ this -> stream ) ) { $ this -> response .= fgets ( $ this -> stream , 1024 ) ; } fclose ( $ this -> stream ) ; $ this -> stream = null ; return $ this ; }
Open Internet or Unix domain socket connection and execute a query
@throws UnexpectedValueException
@return $this
Open Internet or Unix domain socket connection and execute a query