Wednesday, April 14, 2010

cURL commandline utility

A command line tool for getting or sending files using URL syntax.

Since cURL uses libcurl, it supports a range of common Internet protocols, currently including HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, LDAP, LDAPS, DICT, TELNET, FILE, IMAP. POP3, SMTP and RTSP.

The name of the project is a play on 'Client for URLs', originally with URL spelled in uppercase to make it obvious it deals with URLs. The fact it can also be pronounced 'see URL' also helped; it works as an abbreviation for "Client URL Request Library" or the recursive version: "Curl URL Request Library". Distributed under the MIT License, cURL is free software.

Basic use of cURL involves simply typing curl at the command line, followed by the URL of the output to retrieve.

To retrieve the homepage, type:


cURL defaults to displaying the output it retrieves to the standard output specified on the system (usually the terminal window). So running the command above would display the source-code of the homepage.

cURL can write the output it retrieves to a file with the -o flag, thus:

curl -o example.html

A practical example is the cURL for testing the twitter api like posting the tweet (status) as below:
curl -u username:password

Quickest way to download files:
eg: curl -o j2ee-6.pdf
PS: this is indeed a good doc ;)

No comments:

Post a Comment