/ Published in: PHP
URL: http://calebrown.com
This is a simple function that will Cache twitter rss feeds locally so you don't max out your API limit.
Expand |
Embed | Plain Text
function savetwit ($username) { //create the rss feed $local_file = './twitterfeeds/'.$username.'.rss'; { //Find out how many seconds it has been since the file was last updated - in seconds //if it has been more than 10 minutes, update the local feed if ($time_lapse > 600) { //grab the feed from twitter //check to make sure the feed has content and isn't just some error message { //if all looks good, update the local feed file_put_contents($local_file, $feed_grab); } } } else { //grab the feed from twitter //check to make sure the feed has content and isn't just some error message { //if all looks good, update the local feed file_put_contents($local_file, $feed_grab); } } }
You need to login to post a comment.
