>_ IzzyLab

Hands-on task

This task is step 1 of the course “curl and HTTP APIs”

Download the server's response body

easy~3 min

A local web server at http://localhost serves a greeting at the path /hello. Make a GET request and save the response body to the file /root/hello.txt.

The server shows up in the Site tab too: the browser opens its pages there. The task itself is curl in the terminal.

What you'll practise:
  • curl
  • http
  • GET
  • output redirection

Topic breakdown

The HTTP client curl performs a GET by default and prints the response body to the standard output stream. To get the body into a file there are two ways: redirect stdout with shell tools, or use curl's own flag for writing the response to a file. This is the basic difference between "printing to the terminal" and "saving to a file" — the foundation of any work with downloads.

What's checked

  1. response body saved

What it looks like