Getting Started with cURL
Talking to servers from the terminal đ„ïžđ

Curl = Client URL Request Library. With this, we can upload or download data from the internet using the command line. We can also use the cURL command to transfer data between machines. If you ever go to cURLâs website, you will see the subtitle âTransferring data since 1998,â which is very apt.
It is a command-line tool that lets you transfer data to or from a server using various protocols like HTTP, HTTPS, FTP, and more.
To view a website via cURL in the command line, we should use:
curl -L <your website name>
For example, if we want to see the website gaurangpods.com via the terminal, we can simply run the command:
curl -L https://gaurangpods.com
However, note that upon running this command, it does not save anything on our system in a folder. It basically just shows us all the content that the website contains in the terminal, but it does not save it anywhere on our system.
cURL prints the raw response to the terminal. What you see is raw HTML, JSON, or other data.
Unlike a browser, which is designed to make things look pretty for humans, cURL is designed to give developers raw, unfiltered access to server responses.
cURL doesnât download images, doesnât execute JavaScript, and doesnât render CSS. It just fetches data. This makes it fast and lightweight.
cURL works identically on Windows, macOS, and Linux, so your commands are portable across environments.
The -v (verbose) flag shows you everything that cURL sends and receives.
This shows you DNS resolution, connection details, the SSL handshake for HTTPS, full request headers, and full response headers.
Lines starting with > show what cURL sends to the server, and lines starting with < show what the server sends back.
The -I flag fetches only the headers and not the body, which includes the HTTP status code.
GET is the default HTTP method. It is used to retrieve information without modifying anything on the server.
POST is another common HTTP method used with cURL. Unlike GET, which is used only to fetch data, POST is used when we want to send data to the server, such as submitting a form, sending login details, or creating a new record. In cURL, POST requests are usually made when we want the server to process some data and return a response based on that input.
cURL needs to know which protocol to use, so always include http:// or https:// in the URL.




