Pages

Wednesday, 7 September 2005

Blogging from the command line (2)


The key to this is cURL, which comes with Linux and Mac OS X. You'll need to have secure support, because you post to Blogger using HTTPS.


First you need to find out your Blog ID, using this command:

curl --basic --user blogger_username:blogger_password http://www.blogger.com/atom


Now that you have that ID, you can post by the following command (this exploits Bash's here documents):

curl -X POST -T - -H "Content-type: application/xml" --basic --user blogger_username:blogger_password https://www.blogger.com/atom/blog_id <<END

an XML document following these instructions.

END


With that second one, you might want to wrap that up in a script, but hey, remote HTML posting (didn't find a picture upload in the API though).