Hi there. Here is the function that you can use to submit tweets to your twitter account:
<?php
function tweet($message, $username, $password) {
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => sprintf("Authorization: Basic %s\r\n", base64_encode($username.':'.$password)).
"Content-type: application/x-www-form-urlencoded\r\n",
'content' => http_build_query(array('status' => $message)),
'timeout' => 5,
),
));
$ret = file_get_contents('http://twitter.com/statuses/update.xml', false, $context);
return false !== $ret;
}
?>
To use this function, create file named for example post_tweet_to_twitter.php
In that file place the code above and call the function as shown below:
<?php
tweet('Tweet tweet tweet...', 'your_twitter_account', 'your_passw');
?>
You can add a task to your cron manager and set it up to run on required intervals. The command would be like shown below (using Lynx browser):
lynx -source http://www.yourwebsite.com/post_tweet_to_twitter.php > /dev/null