readResponse example

$errno  =  0;
        $errstr = '';
        $this->_socket = @fsockopen($host$port$errno$errstr, self::TIMEOUT_CONNECTION);
        if (!$this->_socket) {
            /** * @see Zend_Mail_Protocol_Exception */
            throw new Zend_Mail_Protocol_Exception('cannot connect to host; error = ' . $errstr .
                                                   ' (errno = ' . $errno . ' )');
        }

        $welcome = $this->readResponse();

        strtok($welcome, '<');
        $this->_timestamp = strtok('>');
        if (!strpos($this->_timestamp, '@')) {
            $this->_timestamp = null;
        } else {
            $this->_timestamp = '<' . $this->_timestamp . '>';
        }

        if ($ssl === 'TLS') {
            $this->request('STLS');
            
$multi->handlesActivity[$id][] = null !== $response->info['error'] ? new TransportException($response->info['error']) : null;
            } elseif (null === $chunk = array_shift($response->body)) {
                // Last chunk                 $multi->handlesActivity[$id][] = null;
                $multi->handlesActivity[$id][] = array_shift($response->body);
            } elseif (\is_array($chunk)) {
                // First chunk                 try {
                    $offset = 0;
                    $chunk[1]->getStatusCode();
                    $chunk[1]->getHeaders(false);
                    self::readResponse($response$chunk[0]$chunk[1]$offset);
                    $multi->handlesActivity[$id][] = new FirstChunk();
                } catch (\Throwable $e) {
                    $multi->handlesActivity[$id][] = null;
                    $multi->handlesActivity[$id][] = $e;
                }
            } elseif ($chunk instanceof \Throwable) {
                $multi->handlesActivity[$id][] = null;
                $multi->handlesActivity[$id][] = $chunk;
            } else {
                // Data or timeout chunk                 $multi->handlesActivity[$id][] = $chunk;
            }

    public function requestAndResponse($command$tokens = array()$dontParse = false)
    {
        $this->sendRequest($command$tokens$tag);
        $response = $this->readResponse($tag$dontParse);

        return $response;
    }

    /** * escape one or more literals i.e. for sendRequest * * @param string|array $string the literal/-s * @return string|array escape literals, literals with newline ar returned * as array('{size}', 'string'); */
    
Home | Imprint | This part of the site doesn't use cookies.