This tutorial will show you how to post new tweet to Twitter automatically by using Twitter API and Twitter OAuth.
1. Register your applicaion
Note: the “Default Access type” need to be set to “Read & Write” as your application is allowed to post new tweet to Twiter.
2. Consumer Secret and Consumer Key
After your application is created, you should have the required information, Consumer Secret and Consumer Key.
Find them in the Application details page.
3. Access Token and Access Token Secret
You should find them by clicking on the “My Access Token” link in the right menu (still on your Application detail page).
4. Download Twitter OAuth class
Go here to get them (OAuth.php, twitteroauth.php)
Note: they are included in Source code example for this tutorial already. 🙂
5. Finally, PHP script for you[php] <?php
$consumerKey = ‘your-consumer-key’;
$consumerSecret = ‘your-consumer-secret’;
$oAuthToken = ‘your-access-token’;
$oAuthSecret = ‘your-token-secret’;
$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);
$tweet->post(‘statuses/update’, array(‘status’ => ‘PHP auto post tweet to Twitter. Read more: http://4rapiddev.com/php/php-auto-post-tweet-to-twitter/’));