Get Your Geek On: Update Twitter From the Command Line

SXSW is in full swing (check out our Underwire blog for more coverage) and that can mean only one thing — more talk about Twitter. But, if you step back from the hype a bit, Twitter starts to look a lot like the old UNIX finger program.
Which is why we were excited to see a post over on Hackszine detailing a dead simple method of posting Tweets from the command line using cURL.
So long as you have cURL installed you can post new tweets using this syntax (keep it all on one line, though I’ve added a linebreak here for readability):
curl -u yourusername:yourpassword -d status="Your Message Here"
http://twitter.com/statuses/update.xml
A slightly better option would be to use the secure address, but in my testing cURL didn’t like the Twitter SSL certificate, so I added the -k flag to turn off the certificate verification:
curl -u yourusername:yourpassword -d status="Your Message Here"
https://twitter.com/statuses/update.xml -k
CURL will receive an XML response from Twitter, letting you know that your post was successful. And of course, if you prefer, you can always post using wget instead of cURL.
Despite the fact that I generally have no use for the navel gazing noise that is Twitter, I do love to see a good API in action — especially one that’s getting back to its command line roots.
See Also:
