GK Logo 003 350 x 100

For a while I have been looking at ways of tweeting regularly (you can see my series of Twitter posts here). Not to annoy people, but just to have a presence a few times a day. Of course, I hope the tweets are also informative.

A quick google will find many tools that are available to do this but, in my view, they all have their shortcomings. Some want payment,  some you have to have your computer on all the time, some are difficult to use, others only have limited functionality and others did not seem to work at all.

Another problem I found was that there was limited scheduling available. For example, you could send the same tweet every n hours or days. You generally had to pay get anything more sopohisticated.

At one point I was running a number of automatic tweet services, just to try and get the service I wanted but it was not really working and took a long time to maintain.

So what did I actually want?

Nothing fancy. I just wanted to send interesting tweets, at “random” times and be able to configure how many I send each day. I was thinking one every couple of hours; nothing too much.

After some recent sucesses in learning more about PHP and SQL I decided to investigate if there was a better option. A solution where everthing could be hosted on my own domain so that I was in full charge of the system, as did not have to rely on (or logon, or pay for) other services.

After some searching I found a PHP class at http://www.phpclasses.org/. The class in question is called twitter-auto-publish. This provides a simple set of tools that enables you to easily post a tweet, as well as providing other functiality (which I have yet to explore).

To post a tweet is very simple. The following lines of PHP are all that are required (and the presence of the require libraries – but that is just a simple case of copying the files to a relevant folder).

@session_start();

require_once(“../php/twitter-auto-publish/openinviter_base.inc.php”);

require_once(“../php/twitter-auto-publish/twitter_auto_publish.inc.php”);

$user=’your user name’;

$pass=’your password’;

$rochak=new twitter_auto_publish();

$rochak->login($user,$pass);

echo ‘Tweeted: ‘ . $msg; // this is the tweet you wish to publish

$rochak->updateTwitterStatus($msg);

$rochak->logout();

Most of it is quite obvious as to what it does, perhaps not how it does it though! The important thing, as far as I am concerned, is that this gives me the basis on which to tweet. Now I have that, I am able to starting thinking about how to exploit this to develop a system that does what I want it to.

More later.