CURL is a mighty tool for transfering data to URLS. It supports a wide range of protocols.

Lets have a closer look on some handy snippets for daily work on the commandline:

Fetching content from a URL

When a page redirects to another location (the respondet http-status is somewhat 3xx)
curl can follow the redirection with the -L (- -location) flag.

Want to see what the request and response headers like?
It’s as simple as using the -v (- -verbose) flag.

For POSTing data to an URL u can use the parameter -d (- -data) .

You want to upload a file (image.jpg is located in the folder from where you run this command) to a php-script running at localhost/upload.php:

a upload-script for taking the uploaded file and store it in a file – the filename is the current timestamp – looks like this: