Update: This has been implemented in curl 7.19.0. See @Besworks answer. According to the man page there is no way to keep the original file name except using multiple O´s. Alternatively you could use your own file name. Get the HTTP Headers of a URL # HTTP headers are colon-separated key-value pairs containing information such as user agent, content type, and encoding. Headers are passed between the client and the server with the request or the response. Use the -I option to fetch only the HTTP headers of the specified resource: curl -I -http2 https://www.
- I found a lot of examples on how to use simple POST commands in cURL, but I didn't find examples on how to send full HTTP POST commands, which contain: Headers (Basic Authentication) HTTP Params (.
- How to send HTTP headers with a cURL GET request? To make a GET request with HTTP headers, use the -H command-line option. You can pass as many HTTP headers with your cURL GET request as you like using the -H command line multiple times.
- Curl request with multiple headers; CRUD Operations on Bookmarks.dev API. Create bookmark - POST; Read created resource - GET; Update created resource - PUT; Delete created resource - DELETE; Conclusion; Introduction. In the first part of the blog post I will do a brief introduction to curl and what it can do (HTTP requests with options).
- This message:[ Message body ] [ More options ]
- Related messages:[ Next message ][ Previous message ][ In reply to ][ Next in thread ] [ Replies ]
Date: Mon, 2 Feb 2004 22:55:33 +0100 (CET)
On Mon, 2 Feb 2004, Kristopher Spencer-Yates wrote:
> It appears my headers still aren't being received. In fact, I am changing
> the CONTENT-TYPE header with -H and using -0 for http1.0 but the receiver
> does not receive what I think it should (my headers).. here is my command
> line
I think you're somehow not doing it right. I simply can't make this fail when
I try to use it.
> /usr/local/bin/curl -0 -X '/AUTHORIZE' -d '<someXML></someXML' -m 120 -H
> 'MIME-VERSION: 1.0' -H 'CONTENT-TYPE: application/PTI21' -H
> 'CONTENT-TRANSFER-ENCODING: text' -H 'REQUEST-NUMBER: 1' -H
> 'DOCUMENT-TYPE: Request' http://the_url:the_portnumber -L
Why are you using uppercase all over? It makes my head hurt! ;-)
I tried this:
$ cd tests
[ cd'ed into the tests directory ]
$ ./server/sws &
[ started the test WWW server that runs on port 8999 by default]
$ curl localhost:8999/1 -H 'test1: yes' -H 'test2: yes' -H 'Pragma: fake' -H
'Host: lalala' -H 'ACCEPT: woohoo'
[ this fetches the data from test case 1, with an additional set of fun -H
arguments ]
$ cat log/server.input
GET /1 HTTP/1.1
User-Agent: curl/7.10.6 (i686-pc-linux-gnu) libcurl/7.10.6 OpenSSL/0.9.7a ipv6
zlib/1.1.3 GSS
test1: yes
test2: yes
Pragma: fake
Host: lalala
ACCEPT: woohoo

[ this shows a somewhat older version supporting all this that I claim it
does. Using my dev version gives the same result. ]
> Output from receiver below:
> ACCEPT: IMAGE/GIF, IMAGE/X-XBITMAP, IMAGE/JPEG, IMAGE/PJPEG, */*
> USER-AGENT: CURL/7.10.8 (I386-PORTBLD-FREEBSD4.8) LIBCURL/7.10.8
> OPENSSL/0.9.7A
Why is the receiver converting everything to uppercase?
> Any ideas on how I should pass multiple headers? What am I missing? Or is
> this not possible?
I don't understand how this cannot work for you. It works for me, as above.
Received on 2004-02-02
Curl Multiple Headers For Sale
- This message: [ Message body ]
- Next message: Kristopher Spencer-Yates: 'Re: cURL doesnt seem to pass multiple headers using multiple -H options'
- Previous message: Kristopher Spencer-Yates: 'cURL doesnt seem to pass multiple headers using multiple -H options'
- In reply to: Kristopher Spencer-Yates: 'cURL doesnt seem to pass multiple headers using multiple -H options'
- Next in thread: Kristopher Spencer-Yates: 'Re: cURL doesnt seem to pass multiple headers using multiple -H options'
- Reply: Kristopher Spencer-Yates: 'Re: cURL doesnt seem to pass multiple headers using multiple -H options'
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
curl allows to add extra headers to HTTP requests.
The HTTP headers are used to pass additional information between the client and the server.
In this article i am showing the examples of how to add header in curl, how to add multiple headers and how to set authorization header from the Linux command line.
Cool Tip: Set User-Agent in HTTP header using cURL! Read more →
Add Header in cURL
Add header X-Forwarded-For:
Set header Accept: application/xml and GET data from the server:
Set header Content-Type: application/json and send data via POST request:
POST data from data.json file:
Example of the data.json file content:
Curl Multiple Headers Command Line
Set Authorization Header in cURL
Basic authentication using Username and Password:
Set header with Basic authentication token:
To generate the basic authentication token, execute:
Set header with Bearer authentication token:
Set header with OAuth authentication token:
Set username and password for Proxy:
If proxy requires authentication using the NTLM method, add --proxy-ntlm option, if it requires Digest add --proxy-digest.
Add header with API-key:
Set Multiple Headers in cURL
Curl Multiple Headers Definition
Add multiple headers:




