public static function feed() { $ncsu = new Tweetgater_Twitter(); $down = false; try { $timeline = $ncsu->getTimeline(); } catch (Exception $e) { $down = true; } $config = $ncsu->getConfigFile(); $fa = array(); $fa['title'] = $config->feed->title; $fa['link'] = $config->site->url . '/feed.php'; $fa['charset'] = 'UTF-8'; $fa['author'] = $config->feed->title; $entries = array(); if (!$down) { foreach ($timeline as $t) { $temp = array(); $temp['title'] = 'Tweet by @' . $t['user-screen_name']; $temp['link'] = 'http://www.twitter.com/' . $t['user-screen_name'] . '/status/' . $t['id']; $temp['description'] = $t['text'] . '<br /><br />Follow @<a href="http://www.twitter.com/' . $t['user-screen_name'] . '">' . $t['user-screen_name'] . '</a>'; $temp['lastUpdate'] = strtotime($t['created_at']); $entries[] = $temp; } } $fa['entries'] = $entries; // importing a rss feed from an array $rssFeed = Zend_Feed::importArray($fa, 'rss'); // send http headers and dump the feed $rssFeed->send(); }
<a href="twitter_oauth.php">Authenticate with Twitter</a> <?php die; } else { ?> Application is configured to speak to twitter. <?php } ?> <h2>Step 7: Confirm Twitter Communication</h2> <?php $ncsu = new Tweetgater_Twitter(); try { $timeline = $ncsu->getTimeline(); echo "Success connecting!"; } catch (Exception $e) { echo "Error Connecting: " . $e->getMessage(); die; } ?> <h2>Step 8: Cleanup</h2> <ul> <li>You should remove the /install directory</li> <li>You should remove write permissions from the /config directory and file</li> </ul> <br /> <h1>You should be all set now!</h1> You can configure these changes by modifying the config.ini file in the /config folder.<br /><br />