Wednesday 13 May 2009

curl for HTTPS (and Twitter)

curl is a powerful library available on different platforms - I use it on Linux debian.

You can use it just to get http pages, or to post data and get a response from a server.
HTTPS is available too.

An example:

curl -k --data @request.xml https://127.0.0.1/service

posts the XML data contained by request.xml using a HTTPS connection (and ignoring invalid certificates, option '-k' - just for testing purposes).

This is a more interesting usage: it's nice to get info from Twitter or even send messages ("update your status") with just a command line:

Get status:
curl http://twitter.com/users/show.xml?screen_name=giavac

Send a message:
curl -u user:password -d "status=describing how to use the Twitter API" http://twitter.com/statuses/update.xml

To install curl on debian:

apt-get install libcurl3

(install dependencies too, and I suggest to include libcurl3-gnutls-dev)

No comments:

Post a Comment

About ICE negotiation

Disclaimer: I wrote this article on March 2022 while working with Subspace, and the original link is here:  https://subspace.com/resources/i...