What does the -v option do in Curl?

The -v option in Curl stands for "verbose". It is used to get more information about the Curl command you are running. When you use the -v option with a Curl command, Curl provides more details about the entire process, including information about the connection and the data transfer.

This additional information can be quite useful for debugging. For instance, you can see the request headers, response headers, and other important details like SSL handshake details, TLS version, certificate details, etc.

Here is an example of a Curl command with the -v option:

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

In the above command, Curl would fetch the HTML for www.example.com and display detailed information about the connection and data transfer in the console. This would include the request headers sent to www.example.com, the response headers received from www.example.com, any cookies sent or received, etc.

Here is a truncated example of the type of output you might see:

*   Trying 93.184.216.34...
* TCP_NODELAY set
* Connected to www.example.com (93.184.216.34) port 80 (#0)
> GET / HTTP/1.1
> Host: www.example.com
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=UTF-8
< Content-Length: 1270
< Date: Mon, 03 Jan 2022 01:23:45 GMT
< 
{ [1270 bytes data]
* Connection #0 to host www.example.com left intact
<!doctype html>
<html>
...

In the above output, lines starting with > are data sent to the server, lines starting with < are data received from the server, and lines starting with * are other information about the connection.

Remember, the -v option can output a large amount of data for even simple requests, so it is typically only used when trying to debug a problem.

Related Questions

Get Started Now

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