- -b
向服务器发送cookie。
// 生成一个标头Cookie: foo=bar,向服务器发送一个名为foo、值为bar的 Cookie
$ curl -b 'foo=bar' https://google.com
// 发送两个 Cookie
$ curl -b 'foo1=bar;foo2=bar2' https://google.com
// 读取本地文件cookies.txt,里面是服务器设置的 Cookie(参见-c参数),将其发送到服务器
$ curl -b cookies.txt https://www.google.com
- -c
参数将服务器设置的 Cookie 写入一个文件。
// 将服务器的 HTTP 回应所设置 Cookie 写入文本文件cookies.txt
$ curl -c cookies.txt https://www.google.com