Course outline · 0% complete

0/25 lessons0%

Course overview →

Meet curl

lesson 5-1 · ~10 min · 14/25

Quiz

Warm-up from lesson 4-3: a request comes back with status 502. Whose side is the failure on?

The engineer's HTTP tool

curl is a command-line program that sends HTTP requests and prints the response. It is on nearly every Mac, Linux box, and modern Windows machine, and it is how engineers poke at APIs and debug web problems without a browser in the way.

The basics:

curl https://example.com          # GET, print the response body
curl -i https://example.com       # also print the response headers
curl -v https://example.com       # verbose: show the request too, plus connection steps
curl -o page.html https://example.com   # save the body to a file

Everything you learned in unit 4 is visible in curl's output. -i shows the status line and headers from lesson 4-2 sitting right on top of the body. -v goes further and narrates the whole lesson 1-2 journey: the DNS lookup, the TCP connect, the TLS handshake, then every request header (lines starting >) and response header (lines starting <).

A guided curl session. Run each command and connect the output to what you learned in unit 4.

Step 1/4: Plain curl performs a GET and prints only the response body, here the HTML of the page.

$ 

Quiz

In curl -v output, what do the lines starting with > show?