cURL (client URL) is a tool we can use to transfer data or get data
from a server using a URL.
The cURL tool support a lot of protocols (http, https, ftp,...).

Testing a website:

When we ping a site and we receive a response that tells us the web server is up. But what if we wanted to know whether the website is up, then we use cURL:


Or we could use the below command to have the same results:


GET
is the method used by default.

The cURL HTTP methods:

  • POST : Create data.
  • GET : Read data.
  • PUT : Update data.
  • DELETE : Delete data.
Using cURL to download files:

We could use curl as we would a wget command to dwmload programs:
curl -O http://full/path/ to_the_programs

Example:

We can download a debian ISO image for example by going to the download site, and right clicking on the link to copy its address:


We get the below link:
https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.7.0-amd64-netinst.iso

Using cURL to look inside servers:

We use the below command to look inside a nginx web server:



cURL and pages redirects:

If the page moves to another location, the "-L" option tells cURL to redirect us to the new location.


Verbose output from cURL:

To get more information about a server for example use the "-V" (verbose) option:


cURL errors (not allowed operations):

We try a POST method on a server but we discover that it does not allow that operation:



Brando Sabatini and Ikbal C ©. Powered by Blogger.