curl cookie


I try to access and set the command to a authentication page,

the cookie receive by using -D to a file is OKAY
the cookie sent by using -b is failed!
the cookie sent by using -H is OKAY.

anyone could advise the -b problem?
if using -H, what’s the best and quick way to get cookie? parse file?


-b, --cookie STRING/FILE  String or file to read cookies from (H)
-c, --cookie-jar FILE  Write cookies to this file after operation (H)
     --create-dirs   Create necessary local directory hierarchy
     --crlf          Convert LF to CRLF in upload
     --crlfile FILE  Get a CRL list in PEM format from the given file
     --ftp-create-dirs  Create the remote dirs if not present (F)
     --ftp-ssl-ccc   Send CCC after authenticating (F)
     --ftp-ssl-ccc-mode ACTIVE/PASSIVE  Set CCC mode (F)
     --ftp-ssl-control Require SSL/TLS for ftp login, clear for transfer (F)
     --ignore-content-length  Ignore the HTTP Content-Length header
-j, --junk-session-cookies Ignore session cookies read from file (H)

Get cookies from

curl -c /tmp/cookies.txt -k
cat /tmp/cookies.txt
# Netscape HTTP Cookie File
# This file was generated by libcurl! Edit at your own risk.     TRUE    /       FALSE   1451577737      PREF    ID=1111111111111111:FF=0:TM=1441630683:LM=1441630683:V=1:S=4_6k-GCyQJxyhYpp   TRUE    /       FALSE   1457441883      NID     71=1nZIrBWTdBTiEHEDLFFFuv2lVe8AieGP5pCdRmaa5OZgi1N2iGDcWf_lzGb-LwF1ZLklFrSUWpQ7ICQCvFpraIzWqQ4Mk114tmUAy_5kCQKkztA3yyQ2BWz-05LgXz50

Send cookie back at next request.

curl -b /tmp/cookies.txt -k

thanks sonnyyu.
The example seems work but not at my situations.
I use -A -e -d -b for curl parameters together, and the -b just doesn't work but -H...
any suggestion?

Plan B: