The curl command is used to make requests and act as a client for a lot of popular network-based protocols. HTTP requests can be created with the curl command easily. HTTP Get request is a popular request to get remote resources via the HTTP protocol. In this tutorial, we will learn how to make HTTP Get requests with the curl command.
Make HTTP Get Request
By default, the curl command makes HTTP requests to the specified URL. So there is no need to explicitly specify the HTTP Get in the curl command. In the following example, we will make an HTTP Get request to the “https://www.linuxtect.com/“.
Verbose HTTP Get Request
An HTTP Get request made with multiple steps. These steps can be printed to the standard output by using the verbose mode.
curl -v https://www.linuxtect.com/
Save HTTP Get Response
The HTTP Get response can be printed to the standard output by default. Also, this output can be stored in a file by using the -o options.
curl -o linuxtect.html https://www.linuxtect.com/
Add Request Header to HTTP Get Request
HTTP headers are used to provide extra parameters for the HTTP Get request. The –header option can be used to add a header for the HTTP Get Request.
curl --header "Content-Type: application/json" https://www.linuxtect.com/