function getSearchResult($s) { $c = 'http://search.twitter.com/search.atom?q=' . urlencode($s); $data = $this->exec($c); $feed = new AtomReader(); $feed->parse($data); return $feed->getItems(); }
/** * Loads input data from RSS or Atom feeds into NewsItem entries */ function load($data) { if (is_array($data)) { $this->addItems($data); return; } if (is_url($data)) { $http = new HttpClient($data); if ($this->getDebug()) { $http->setDebug(); } $data = $http->getBody(); } if (strpos($data, '<rss ') !== false) { $feed = new RssReader(); } else { if (strpos($data, '<feed ') !== false) { $feed = new AtomReader(); } else { echo 'NewsFeed->load error: unhandled feed: ' . substr($data, 0, 100) . ' ...' . ln(); return false; } } if ($this->getDebug()) { $feed->setDebug(); } $feed->parse($data); $this->title = $feed->getTitle(); $this->addItems($feed->getItems()); }
/** * Get FeedReader object for the feed. * * @return FeedReader */ private function getReader() { if (!$this->reader) { $xml = $this->getXML(); if (RSSReader::canRead($xml)) { $this->reader = new RSSReader($xml); } else { if (AtomReader::canRead($xml)) { $this->reader = new AtomReader($xml); } else { $this->reader = new NullReader($xml); } } } return $this->reader; }