php5 -q /full/path/to/your/script/dm-twitter.php >/dev/null 2>&1
.And that’s it! Now you have a small JSON file that updates with new tweets from Twitter every minute. The only thing left to do is to grab this JSON file and process it to display your tweets on your site (or wherever you want to put it). On some of my sites, I use JavaScript to display the tweets, and on other sites, I’m just accessing the JSON file with PHP, but I’ll leave that up to you how you use it.
Now my server only accesses Twitter once every minute, (not with every request) and it runs in the background. All my sites just need to access this one JSON file now, and it’s formatted just how I want it to be, and is much leaner than the JSON file you get from Twitter.
Let me know if you have any thoughts, questions, comments, or anything you have to say by writing a comment below. Thanks for reading – I hope this helps!