How to Add a Header to a curl Request

Date:

Share post:

curl is one of those great utilities that’s been around seemingly forever and has endless use cases. These days I find myself using curl to batch download files and test APIs. Sometimes my testing leads me to using different HTTP headers in my requests.

To add a header to a curl request, use the -H flag:

curl -X 'GET' \
 'https://nft.api.cx.metamask.io/collections?chainId=1' \
 -H 'accept: application/json' \
 -H 'Version: 1'

You can add multiple headers with multiple -H uses. Header format is usually [key]: [value].

Request Metrics real user monitoring
Request Metrics real user monitoring
Request Metrics real user monitoring
  • How I Stopped WordPress Comment Spam

    How I Stopped WordPress Comment Spam

    I love almost every part of being a tech blogger:  learning, preaching, bantering, researching.  The one part about blogging that I absolutely loathe:  dealing with SPAM comments.  For the past two years, my blog has registered 8,000+ SPAM comments per day.  PER DAY.  Bloating my database…

  • Create a CSS Flipping Animation

    Create a CSS Flipping Animation

    CSS animations are a lot of fun; the beauty of them is that through many simple properties, you can create anything from an elegant fade in to a WTF-Pixar-would-be-proud effect. One CSS effect somewhere in between is the CSS flip effect, whereby there’s…

  • Digg-Style Dynamic Share Widget Using MooTools

    Digg-Style Dynamic Share Widget Using MooTools

    I’ve always seen Digg as a very progressive website. Digg uses experimental, ajaxified methods for comments and mission-critical functions. One nice touch Digg has added to their website is their hover share widget. Here’s how to implement that functionality on your site…

  • Flext: MooTools Auto-Growing Textrea Plugin

Source link
spot_img

Related articles

Stuck with AI App Builders Like Replit? Get Expert Help to Finish Your App

Building an app with AI-powered platforms like Replit can feel like a dream come true—until you hit a...

Pick up a Samsung SmartTag 2 tracker for only $16 right now

We live in a world filled with so much stuff. There's keys, phones, wallets — the list goes...

U.S. Seizes $7.74M in Crypto Tied to North Korea’s Global Fake IT Worker Network

The U.S. Department of Justice (DoJ) said it has filed a civil forfeiture complaint in federal court that...