What does the -i option do in Curl?

The -i option in cURL stands for include. When used with a cURL command, it includes the HTTP response headers in the output. The HTTP headers include information like the server name, date, content type, and more.

By default, when you use cURL to make a request, it only displays the response body in the output. However, when debugging or when you need more information about the response, headers can be very useful. This is where the -i option comes in handy.

Here is an example of how to use the -i option in a cURL command:

curl -i https://www.example.com

When you run this command, cURL will fetch the URL (https://www.example.com in this case), and include the HTTP headers in the output.

An example output might look something like this:

HTTP/2 200 
date: Wed, 07 Jul 2021 11:12:13 GMT
content-type: text/html; charset=UTF-8
server: Apache

<!doctype html>
<html>
<head>
    <title>Example Domain</title>
...

In the output, you can see the HTTP headers (like date, content-type, and server) followed by the response body (the HTML of the web page).

Related Questions

Get Started Now

WebScraping.AI provides rotating proxies, Chromium rendering and built-in HTML parser for web scraping
Icon