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);
}