I have a small application that display traffic issues on public transportation in my small country: Belgium.
I made a system in the application that allow users to warn all people when there is delay on the trains, for instance.
What I would like to do is to allow my trusted users to tweet from my account something like “User X said 3 minutes delay on train 123456”
SO basically, i would like to hardcode the twitter username and password in the code and send the tweet, as I have all the credentials. (basically, I would also check that I post only 1 or 2 tweets an hour)
I have read the twitter documentation, but couldn’t find any information on that.
It think that’s possible via php:
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $twitter_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "{$twitter_user}:{$twitter_password}");
from here: http://www.webmaster-source.com/2009/04/05/post-to-twitter-from-a-php-script/
You would have to have your own server that the application sends messages to. Upon receipt of a message, your app would then use oauth to log in to twitter and post the message using your credentials.
There are twitter and/or oauth libraries available for a lot of different languages and web apps, so it should be pretty easy to set something up.
If you go this route, you should register your (server) app on twitter, and then you’ll have the keys you need to get started.