Working on a command line has its own benefits and gives you a satisfying feeling! How about twittering from command line? Thats even cooler and yes its very much possible. All you need to have is curl. curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos…), file transfer resume, proxy tunneling and a busload of other useful tricks.Check out the following commands:
- Get the public timeline, unauthenticated: curl http://twitter.com/statuses/public_timeline.rss
- Get your friends timeline, authenticated: curl -u email:password http://twitter.com/statuses/friends_timeline.xml
- Just the headers, please: curl –head -u email:password http://twitter.com/statuses/friends_timeline.json
- Post a status update, authenticated: curl -u email:password -d status="your message here" http://twitter.com/statuses/update.xml
These are mentioned over at the Twitter API page. However you can take this step further and write your own script so that you don’t have to type the lengthy commands over and over again and perhaps not even the email and password if you are okay with storing them in a script file. Here is an example (feel free to copy and paste):
twitterName="<<<Your twitter username here>>> "
password="<<<Your password here>>> "
$curl –basic –user "$twitterName:$password" –data-ascii \
"status=`echo $@ | tr ‘ ‘ ‘+’`" \
Please note that its –basic (2 dashes), –user (2 dashes) and –data-ascii (2 dashes). Give the file a name such as "myTwitterer". Then you can simply type "myTwitterer <Your status update here>" and you status will be updated right from your command line. Be aware that the password will be stored in the script file without any encryption or security measures, however this file will reside on your local machine so its reasonably safe to do this.
Similarly you can use the other URLs I mentioned and get timelines both public and your friends! The whole processes can be down on windows as well all you need is cURL which you can get here.