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