Curl is a command-line utility for transferring data to or from a server over HTTP, HTTPS, FTP, and SFTP. Curl commands work without user interaction and are therefore ideal for use in automation scripts. Curl command-line tool provides a number of advanced options such as resuming transmission, limiting bandwidth, proxy support, user authentication, and more. In this article, we will go over the 12 most important Curl commands for making requests over HTTP/HTTPS.
The list of URLs is passed to Curl with one of the command line options -o or -O. The -O option tells Curl to save each resource with its original filename.
5. Check Page HTTP headers
curl -I https://reqbin.com
The -I parameter tells Curl to send an HTTP HEAD request to the server instead of a GET. The HEAD request is similar to a GET, except that the server only returns HTTP headers. This is optional if you only want to check URL headers and don't want to load the page content.
6. Force Curl to use HTTP/2
curl --http2 https://reqbin.com
The --http2 option forces Curl to use the HTTP/2 protocol. Combined with the -I parameter, it can be used to check if a website supports HTTP/2.
7. Do Follow Redirects
curl -L https://www.reqbin.com
By default, curl does not follow redirects (status codes 301 and 302). The -L option tells Curl to do redirects.