Tuesday, March 8, 2011

How to enable cookies in Linux Curl

Curl is an excellent tool to debug HTTP-related software. What curl does is transferring data from given URL.

Unfortunately by default curl doesn't store cookie values.

To enable cookies support in curl use -b (read cookie data file) and -c (write cookies data to file) options:

$ curl http://localhost/myApp -c cookieFile -b -c cookieFile
Cookie value: 1
$ curl http://localhost/myApp -c cookieFile -b -c cookieFile
Cookie value: 2

No comments:

Post a Comment