CURL

CURL

Curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP, or FILE). The command is designed to work without user interaction.

curl offers a busload of useful tricks like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume and more.

Options

-o                    –output: write to file

-u user:pass  –user: Authentication

-v                    –verbose

-vv                   Even more verbose

-s                    –silent

-i                    –include: Include the HTTP-header in the output

-I                    –head: headers only

SSL

    –cacert

    –capath

-E, –cert                –cert: Client cert file

    –cert-type        der/pem/eng

-k, –insecure         for self-signed certs

Data

-d ‘data’              –data: HTTP post data, URL encoded (eg, status=”Hello”)

-d @file               –data via file

-G                         –get: send -d data via get

Headers

-A                          –user-agent

-b name=val        –cookie

-b FILE                  –cookie

-H “X-Foo: y”       –header

–compressed      use deflate/gzip

Examples

Post data:

curl -d password=x http://x.com/y

Auth/data:

curl -u user:pass -d status=”Hello” http://twitter.com/statuses/update.xml

multipart file upload

curl -v -include –form key1=value1 –form upload=@localfilename URL

Use Curl to Check if a remote resource is available

curl -o /dev/null –silent -Iw “%{http_code}” https://example.com/my.remote.tarball.gz