Search⌘ K

Making Web Requests with cURL

Explore how to use the cURL command-line tool to make HTTP requests, understand response headers, and handle redirects. Learn to inspect server responses, download files, and interact with web APIs for practical command-line networking tasks.

We'll cover the following...

Using cURL

cURL is a powerful command-line tool for interacting with web servers. By using curl, we can make requests, view the responses, download files, grab information about remote servers, or interact with remote APIs. cURL does exactly what our web browser does, except that it doesn’t render the HTML. So, let’s explore how it works.

Let’s use curl to request a URL. We execute this command in our terminal to request Google’s home page:

curl http://google.com
Terminal 1
Terminal
Loading...

Responses from web servers come in two parts: the response header and the response body. The curl command shows the response body by ...