SimpleHttpResponse::__construct PHP Method

__construct() public method

Constructor. Reads and parses the incoming content and headers.
public __construct ( SimpleSocket $socket, SimpleUrl $url, mixed $encoding )
$socket SimpleSocket Network connection to fetch response text from.
$url SimpleUrl Resource name.
$encoding mixed Record of content sent.
    public function __construct($socket, $url, $encoding)
    {
        parent::__construct();
        $this->url = $url;
        $this->encoding = $encoding;
        $this->sent = $socket->getSent();
        $this->content = false;
        $raw = $this->readAll($socket);
        if ($socket->isError()) {
            $this->setError('Error reading socket [' . $socket->getError() . ']');
            return;
        }
        $this->parse($raw);
    }