How to Send a HEAD Request With cURL?

The HEAD HTTP method is used to gather information and metadata about a specific resource. It's very similar to GET, but instead of retrieving the entire response data, it excludes the body and only returns the headers.

To send HEAD requests with cURL, we can use the -I cURL option:

curl -I

The response of the above cURL HEAD request is the following:

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Content-Security-Policy: frame-ancestors 'self' *; font-src 'self' *; default-src 'self' *; img-src 'self' *; media-src 'self' *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *; frame-src 'self' *; worker-src 'self' *; connect-src 'self' *
Content-Type: application/json; encoding=utf-8
Date: Wed, 06 Mar 2024 10:34:03 GMT
Permissions-Policy: fullscreen=(self), autoplay=*, geolocation=(), camera=()
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block

For further details on cURL, including configuring its commands and using it for web scraping, refer to our dedicated guide.

How to Use cURL For Web Scraping

Explore sending and configuring HTTP requests with cURL through a step-by-step guide. You will also explore advanced usages of cURL for web scraping, such as scraping dynamic pages and avoiding getting blocked.

curl web scraping article banner

Provided by Scrapfly

This knowledgebase is provided by Scrapfly — a web scraping API that allows you to scrape any website without getting blocked and implements a dozens of other web scraping conveniences. Check us out 👇