indie Posted August 30, 2011 Share Posted August 30, 2011 Does anyone know how to cache Tweets as to not reach the API rate limit? I am using the Twitter-provided widget to display multiple profiles on a website, but the API hits the limit of 150 per hour. Is there any way to cache the Tweets and still use this widget? Or does anyone know of a good widget that caches, or simple code? If anyone knows, please explain in newbie terms. Thanks a lot! Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted August 30, 2011 Share Posted August 30, 2011 http://www.catswhocode.com/blog/10-code-snippets-to-interact-with-twitter Quote Link to comment Share on other sites More sharing options...
indie Posted August 30, 2011 Author Share Posted August 30, 2011 Thanks, but I'm not seeing cache code. Quote Link to comment Share on other sites More sharing options...
indie Posted August 30, 2011 Author Share Posted August 30, 2011 Any help appreciated. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted August 30, 2011 Share Posted August 30, 2011 have you thought to use twitter cache and JSON:confused: http://mark.koli.ch/twittercacher/TwitterCacher.phps http://mark.koli.ch/twittercacher/JSON.phps example: <?php require_once("JSON.php"); require_once("TwitterCacher.php"); $twEmail = "you@example.com"; $twPass = "password"; $json = new Services_JSON(); $tc = new TwitterCacher($twEmail,$twPass); // I do this just to be a nice guy. So Twitter knows who we are. $tc->setUserAgent("Mozilla/5.0 (compatible; TwitterCacher/1.0;)"); // Read the timeline from the cache, or from Twitter. $timeline = $json->decode( $tc->getUserTimeline() ); foreach( $timeline as $tweet ) { // Get the Tweet itself. $text = $tweet->text; // Twitter uses GMT+0 but I convert it to my local time. $date = date('M j, Y @ h:i A', strtotime($tweet->created_at)); echo $text . "<br />" . $date . "<hr />"; } ?> Quote Link to comment Share on other sites More sharing options...
indie Posted August 30, 2011 Author Share Posted August 30, 2011 Can that be used in conjunction with the widget Twitter provides? And if so how? Thanks a lot. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.