How to send HTTP header using cURL?

In this quick tip we have demonstrated a quick way to send HTTP header using cURL.

How to send HTTP header using cURL?

To send HTTP headers using cURL, you can use the -H or –header option followed by the header information. Here’s an example of how to send HTTP headers using cURL:

curl -H "HeaderName1: HeaderValue1" -H "HeaderName2: HeaderValue2" URL

Replace HeaderName1 and HeaderValue1 with the name and value of the first header you want to send. Similarly, replace HeaderName2 and HeaderValue2 with the name and value of the second header. You can include as many headers as needed.

Finally, replace URL with the actual URL you want to send the request to.

Here’s an example with sample headers:

curl -H "Content-Type: application/json" -H "Accept: */*" https://api.example.com/endpoint

In this example, the Content-Type header is set to “application/json” and the Accept header is set to /. The request is sent to https://api.example.com/endpoint.

Additional Resources

Try Scrapingdog for Free!

Get 200 free credits to spin the API. No credit card required!