To post Automatically in twitter using php follow the steps:
First you need a valid account in twitter.
1.create an application with your twitter account in the following link
https://dev.twitter.com/
2.create consumerkey,consumer secret,access token,access token secret for your application.
3.Set permission mode for your apllication in read,write, permission .
4.Download twitteroauth.php from twitter offical website.
require_once('twitteroauth.php');
// To connect with Twitter you need to give the deatils
$Consumerkey = 'consumer key';
$ConsumerSecret = 'consumer secret';
$tAccessToken = 'access token';
$tAccessTokenSecret = 'access token secret';
// start connection
$tweet = new TwitterOAuth($Consumerkey, $ConsumerSecret, $tAccessToken, $tAccessTokenSecret);
//Your message
$message = "This is an example twitter post using PHP";
// Post to twitter
$msg = $tweet->post('statuses/update', array('status' => $message));