Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
Using the Twitter API to Tweet Repetitive Content
May 03, 2017 @ 09:58:18

On the TutsPlus.com site they've continued their series covering the use of the Twitter API from PHP. In this latest tutorial author Jeff Reifman shows you how to use the API to tweet content repetitively at different intervals and with randomized content. The tutorial uses a Yii2 framework application as its base.

Welcome back to our coverage of the Twitter API. If you use Twitter, you may have come across a friend sharing tweets from the @infinite_scream bot (shown above). I know it's mostly a bot because it tweets at ten-minute intervals. But it varies the string length of its virtual screams to avoid being blocked by the Twitter's API's infamous undocumented restrictions. Tweet too frequently or repeat the same content and you'll find your bots hopelessly blocked.

Recently, an online friend asked me to help them write code for a bot that might repeat but provide some intelligent content variation. In today's tutorial, I'll write about how to do this with the Twitter API.

He starts off with the registration of a new Twitter application and the creation of the table to store the tweet variations. Next he uses the CRUD and model generators in Yii2 to build out the model and controller skeletons. He then creates the migrations/tables/models for the random hashtags and URLs the bot will include in its tweets. Finally, he shows the creation of the code to make the random tweets and how he made the choice of when to tweet. The post ends with the code to send off the tweet (the job) and an example of the results.

tagged: twitter api repetitive content tutorial series bot random

Link: https://code.tutsplus.com/tutorials/using-the-twitter-api-to-tweet-repetitive-content--cms-28096