libcurl, written by Daniel Stenberg and many contributors, implements a set of routines which enable a programmer to very easily embed HTTP, FTP and other not quite so obvious protocols into her application, and curl is the command line program that demonstrates libcurl's power. Both the library and the command line program are supported on great number of platforms (including Windows) and source and binary downloads are available here. curl's manual page is huge but well worth reading. The binary curl program can be built with a manual included (accessible via the –M option). I use curl mainly for HTTP and FTP. Retrieving a URL is easy: curl URL gets it. I usually don't want the progres meter, so I use the –s to silence it, and for use in scripts, I want curl to –fail with an error code. So, a curl –sf will get me a copy of the URL. Submitting forms is just as easy: –F firstname=Jan-Piet simulates the equivalent of

in HTML, and a file upload can be done with –F file=@filename. Some of the less obvious protocols accessible by curl include LDAP. curl can output the HTML code of a request (curl ldap://,dc=fupps,dc=com?cn), but I always recommend the much more powerful ldapsearch instead. I have often used libcurl within applications, which include but are not limited to a Lotus Domino Server Addin Task for user registration as well as a similar project named Blogit (which I used to write this posting), and curl I use on a daily basis such as for backing up my bookmarks. For more information on curl and libcurl, I obviously recommend an article by yours truly published in the German language in iX magazine, as well as sundry online resources.

Flattr this
LDAP, Linux, Apache, MacOSX, and CLI :: 04 Mar 2007 :: e-mail


blog comments powered by Disqus