Monday, July 5, 2010
8:12 PM

Tweet from command line using curl

curl is a client to get documents/files from or send documents to a server, using any of the supported protocols (HTTP, HTTPS, FTP, GOPHER, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction or any kind of interactivity.

curl offers a busload of useful tricks like proxy support, user authentication, ftp upload, HTTP post, SSL (https:) connections, cookies, file transfer resume and more

curl is availabe mostly on all Linux distros but you can download a binary package from cURL's download page if you don't have it installed.

Open the terminal and past the below mentioned command to send the status to the twitter
curl --basic --user username:password --data status="Linux" http://twitter.com/statuses/update.xml
command explanation
--basic --user username:password

The above piece of code will authenticate your Twitter username and password.

--data status="Linux"

The above piece of code will send the data to the API i.e your new status which will be in the form of POST HTTP request.

http://twitter.com/statuses/update.xml

The main part of the code which is the URL of the Twitter API.

0 comments:

Post a Comment