SimpleBrowser::fetch PHP Method

fetch() protected method

Jointly recursive with the parse() method as it descends a frameset.
protected fetch ( string/SimpleUrl $url, SimpleEncoding $encoding, integer $depth ) : SimplePage
$url string/SimpleUrl
$encoding SimpleEncoding GET/POST parameters.
$depth integer Nested frameset depth protection.
return SimplePage Parsed page.
    protected function fetch($url, $encoding, $depth = 0)
    {
        $http_referer = $this->history->getUrl();
        if ($http_referer) {
            $this->user_agent->setReferer($http_referer->asString());
        } else {
            $this->user_agent->setReferer(null);
        }
        $response = $this->user_agent->fetchResponse($url, $encoding);
        if ($response->isError()) {
            return new SimplePage($response);
        }
        return $this->parse($response, $depth);
    }