DEV Community

Hiral
Hiral

Posted on

Getting Started with cURL

Let's understand basic terminology before moving forward:

Suppose you open google.com in browser

Client

A client is a computer or device on internet that request information from server. Here your computer(browser) is the client

Server

A server is a computer on internet that stores data and wait for client to send request.
Google.com is hosted on machine that acts as server

Request

A request is what computer ask to server.
Eg. Give me google homepage

*response: *

A response is what server send back to client
HTML content, images or data

Types of request:

GET : used to get data from server
POST: used to send data to server
PATCH: used to update only specific field on server
PUT: used to update or replace entire data on the server
DELETE : used to delete some data on the server

what is Curl and why developer need it?
Curl is command line tool to send request to server and receive response.
It can be used to:
Fetch content
Test API
Send and receive data over internet

Eg.
Curl http://google.com
It sends request to google.com. Receives HTML content in response.

Curl --data "name=test" http://test.com
It send post request to test.com, in return post request send back the status if it received the data or not

Top comments (0)