# Getting Started with cURL

Welcome to a new article.

In this article we will learn about cURL. But before learning about cURL, first we need to understand what is a server.

A server is software which receives a request to process and provide response for that request. Basically, the server receives a request from the client (device used by the user), and the server processes it and provides a response to the client. This architecture is called client-server architecture.

So as we have understood about the server, then let’s continue with cURL.

### What is cURL?

cURL stands for Client URL. cURL is a command-line tool, and it is used for the transfer of data to or from a server with supported protocols. It means cURL is like a transporter, which transports data to the server or from the server. cURL is also used to send api request

### Why do programmers need cURL?

Programmers need cURL because they can use cURL to test the API’s by making api request. Also, cURL is a cross-platform command-line tool, which means it maintains consistency over different development environments.

### First request using cURL.

* curl &lt;URL&gt;: Prints URL content as output
    

```bash
curl https://www.masterji.co
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769187862050/f704f6d4-7711-4f03-8283-7fd8abb18b08.png align="center")

```bash
curl https://catfact.ninja/fact
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769188593197/e8ad58b6-9060-425b-b480-5f2b7580b54f.png align="center")

* curl -X &lt;http method&gt; &lt;api endpoint&gt;
    

```bash
curl -X GET https://catfact.ninja/fact
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769188895061/4f4c98d1-fc5e-4423-bd70-d16740460c75.png align="center")

The output returned by the commands we have used above in the example are responses from the servers. A response mainly contains a status and data returned from the internal processing of the server.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769192533871/f89f65f1-5cf8-4faa-b602-b9986fe62b7f.png align="center")

### Some more commands of cURL

* curl -i &lt;URL&gt;: Output also includes headers
    

```bash
curl -i <URL>
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769189553663/eee96179-92d5-4fc4-8fac-7f594691e27b.png align="center")

* curl -I &lt;url&gt;: It return only headers
    

```bash
curl -I <URL>
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769189650915/7fee261e-0bc2-4ce6-ba58-84d586d8d4ad.png align="center")

* curl -V &lt;URL&gt;: Shows request response details
    

```bash
curl -V <URL>
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769189842960/39558b38-c308-4470-b077-7338cb61467c.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769189872898/c7718066-474d-4d30-af76-ba4f77930fab.png align="center")

* combination of curl options
    

```bash
curl -X POST -H "Content-Type: application/json" -d '{"title":"Test Post","body":"This is a test","userId":1}' https://jsonplaceholder.typicode.com/posts
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769191596598/bff6cd66-cab8-4865-858a-709184a408d1.png align="center")

### Mistakes that beginners make using cURL

1. Generally beginners don’t understand the options that cURL provides us. These options help to get what we need from the server.
    
2. By default, cURL makes a GET request. But where server configured for any other type of request then we need to mention type of request in command and beginners sometimes make mistakes there.
    

Hope you all liked the article.

Thank You!
