_feedUrl = $this->_getFeedUrl($feed); if (!$this->_feedUrl) { throw new \Exception('XML feed "' . $feed . '" undefined'); } } abstract protected function _parseFeedContent($feed); protected function _fetchFeedContent($url) { $userAgent = file_get_contents('../config/user-agent'); $context = stream_context_create([ 'http' => [ 'method' => "GET", 'header' => "Accept: text/html,application/xml,application/xhtml+xml,text/xml\r\nAccept-Language: en;1=0.7\r\nUser-Agent: " . $userAgent, ] ]); return trim(file_get_contents($url, FALSE, $context)); } protected function _fetchItems() { $feedContent = $this->_fetchFeedContent($this->_feedUrl); $this->_feedXml = new \SimpleXMLElement($feedContent); return $this->_parseFeedContent($this->_feedXml); } protected function _spamFilter($content) { return $content; } protected function _sortContent($content) { return $content; } } ?>