PicoFeed\Scraper\Scraper::download PHP Method

download() public method

Download the HTML content.
public download ( ) : boolean
return boolean
    public function download()
    {
        if (!empty($this->url)) {
            // Clear everything
            $this->html = '';
            $this->content = '';
            $this->encoding = '';
            try {
                $client = Client::getInstance();
                $client->setConfig($this->config);
                $client->setTimeout($this->config->getGrabberTimeout());
                $client->setUserAgent($this->config->getGrabberUserAgent());
                $client->execute($this->url);
                $this->url = $client->getUrl();
                $this->html = $client->getContent();
                $this->encoding = $client->getEncoding();
                return true;
            } catch (ClientException $e) {
                Logger::setMessage(get_called_class() . ': ' . $e->getMessage());
            }
        }
        return false;
    }