Tweeting from Shell using Twitter API

By: Zhiqiang Ma In: Linux

Twitter’s API is easy to use:

curl -u username:password -d status="Tweeting msg" http://twitter.com/statuses/update.xml

or

curl -u username -d status="Tweeting msg" http://twitter.com/statuses/update.xml

Then type in password.

I have written a script twitter:

#!/bin/bash

username=USERNAME

password=PASSWORD

curl -u $username:$password -d status="$*" http://twitter.com/statuses/update.xml

Change the USERNAME and PASSWORD to the account’s username and password. Then put this script into ~/bin/ and add x mod to it by:

$ chmod +x ~/bin/twitter

When tweeting:

$ twitter Tweeting message is here

Enjoy it!

Author: Zhiqiang Ma Posted on: Apr 1, 2010 Views: 261
Tags: , ,
Like this post? Subscribe full-text feeds from all Fclose.com blogs:
Add your comments, share your thoughts

Be nice. Keep it clean. Stay on topic. No spam.