介绍
介绍
福哥要在使用curl请求接口的时候加上cookie参数怎么办?
教程
格式
其实通过curl --help就能知道怎么弄了。
通过文件传递
编辑一个cookie.txt文本文件,加入cookie设置内容,格式如下:
[域名] FALSE [URI] FALSE [过期时间Unix时间戳] [变量名称] [变量值]
福哥把前面的例子写成了cookie.txt格式,内容如下:
localhost FALSE / FALSE 0 uid 35 localhost FALSE / FALSE 0 uname tongfu.net
现在福哥使用cookie.txt文件想接口传递cookie参数。
curl -i --cookie cookie.txt "http://localhost/api/status"